Do Some Basic UNIX: Difference between revisions

From Center for Cognitive Neuroscience
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<h2>Some basic unix commands</h2>
<h2>Some basic unix commands</h2>
<h3>Want more? Try the excellent tutorials at
[http://freeengineer.org/learnUNIXin10minutes.html FreeEngineer.org],
[http://www.mayo.edu/bir/bir/tutor.html Mayo],
[http://www.unixgeeks.org/security/newbie/unix/ UnixGeeks.org] or
[http://www.isu.edu/departments/comcom/unix/workshop/unixindex.html Idaho state]


<h3>Want more? Try the excellent tutorials at <a href="http://freeengineer.org/learnUNIXin10minutes.html">FreeEngineer.org</a>, <a href="http://www.mayo.edu/bir/bir/tutor.html">Mayo</a>, <a href="http://www.unixgeeks.org/security/newbie/unix/">UnixGeeks.org</a> or <a href="http://www.isu.edu/departments/comcom/unix/workshop/unixindex.html">Idaho state</a>
     <p>
     <p>
<table border="1" cellpadding="2" cellspacing="2">
<table border="1" cellpadding="2" cellspacing="2">
Line 154: Line 158:
</tr>
</tr>
</table>
</table>
<div align="right">
<table border="0" cellpadding="0" cellspacing="2" width="100%">
<tr>
<td><a href="http://www.brainmapping.org"><img src="../BMC_IMAGES/BMDbutton.GIF" border="0" width="60" height="51" align="middle"></a></td>
<td align="center"><table border="0" cellpadding="10" cols="1" width="1%">
<tr>
<td nowrap bgcolor="#ffffcc" width="48%"><a href="index.html">Back to HowTo pages</a></td>
</tr>
</table></td>
<td width="48%">
<div align="right">
<font size="-1">This page is maintained by <a href="mailto:mscohen@ucla.edu">Mark Cohen</a> [updated 06.27.05]</font></div>
</td>
</tr>
</table>
</div>

Revision as of 00:25, 9 September 2006

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">

Some basic unix commands

Want more? Try the excellent tutorials at FreeEngineer.org, Mayo, UnixGeeks.org or Idaho state

Command Meaning
man function show the manual page for a function
top shows currently running processes - do not leave this running for more than 30sec (ctrl-c)
ps show the names of all running processes
mkdir dir_name create a sub-directory of the current directory
rmdir dir_name remove a directory. You must remove files in the directory first.
cp source dest copy a file or directory from source to dest
rm file_name remove a file (permanent!)
chmod xxx file_name change the file permissions:

Three numbers indicate the permissions for the owner, the group and the world.

1 - execute permission
2 - write permission
4 - read permission

You can add these permissions together, for example:

7 - read, write, execute
6 - read and write (not execute)
5 - read and execute (not write)

chmod 777 filename

  • Give all users read, write and execute

chmod 744 filename

  • owner read, write, execute
  • group members and all others read only

chmod 755 filename

  • owner read, write, execute
  • all other read and execute (but not write)

chmod 700 filename

  • owner read, write execute
  • others: no access

chmod -R will make these changes to all of the files in any sub-directories, as well.

ls list contents of current directory
ls -l list the contents of the directory (long form, showing sizes)
ls dir_name list the contents of the named directory
cd dir_name change to the named directory
pwd show the name of the current directory
. the current directory
.. the parent directory of this directory
more file_name print out the contents of the named (text) file
df show the free space on the present disk
du show the disk usage on the system
* unix wild card - matches all file names (except those beginning with '.')

e.g. rm * will remove all files from the current directory!

<blink>You will absolutely never type 'rm *'. Ever.</blink>

Always type something like "ls *" first to verify what such a wildcard will match

xemacs file_name

textedit file_name
nedit file_name

vi file_name
These are all text editors that are found commonly on unix systems.
Most people seem to prefer xemacs, but each has its adherents.
? matches any single character