1977
Comment:
|
3681
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
#acl GoodGroup:admin,read,write,delete,revert CambridgeGroup:read CbuGroup:read |
|
Line 5: | Line 7: |
|| Show contents of current directory: || ls || (details: ls –l, hidden files: ls –a, output to file: ls > file.txt) || || Change directory: || cd || (one up: cd .. | to home directory cd ~) || ||Make directory: || mkdir newdir || || || Copy file/directory: || cp old new || || || Move file: || mv old new || || || Delete file: || rm filename || delete directory: rm –r dirname || || Show load of linux boxes: || showload || || || Change linux box: || ssh l42 || || || dos2unix || || || || grep || || || || See list of previous commands: || history || || || Show features of current linux box: || uname –a || || || Help on linux commands: || man yourcommand (quit typing “q”) || || || Edit files: || nedit, emacs, vi || || |
|| Show contents of current directory || ''ls'' || details: ''ls –l'', hidden files: ''ls –a'', output to file: ''ls > file.txt'', wild cards: ''ls *.txt'' || || Change directory || ''cd <newdir>'' || e.g. ''cd /home/myname/mydatadir'', one up: ''cd ..'' (e.g. ''cd ../batchfiles'', to home directory: ''cd ~'') || ||Make directory || ''mkdir <newdir>'' || || || Copy file/directory || ''cp <old> <new>'' || Copy directories: ''cp -r <old> <new>'' || || Move file/directory || ''mv <old> <new>'' || || || Delete file || ''rm <filename>'' || delete directory: ''rm –r <dirname>'' || || Create link between a new filename and an existing file || ''ln <filename> <linkname>'' || symbolic link: ''ln -s <filename> <linkname>'', to see whether a file is "real" or a symbolic link, use ''ls -l'' || || Find letter string within text || ''grep'' || ''grep error logfile.txt'', ''ps -ef | grep <yourname>'' || || See list of previous commands || ''history'' || || || Execute command from history list || ''!<x>'', where ''x'' is number in history list || e.g. ''!112'' || || Send output of a command to text file || ''>'' || e.g. ''ls -l > listoffiles.txt'', ''>>'' appends instead of overwriting || || Send output of a command directly to another command ("pipes") || ''|'' || e.g. ''grep myfile.txt | ls -l'' || || Changing access permissions || ''chmod'' || e.g. ''chmod 755 <myfile>'' || || Show load of linux boxes || ''showload'' || || || Change linux box || ''ssh <machine>'' || e.g. ''ssh l42'' || || Show current processes || ''ps'' || ''ps -ef'' || || Show most CPU-intensive tasks on current processor || ''top'' || || || Checking where an executable file is located || ''which <filename>'' || || || Show features of current linux box || ''uname'' || ''uname -a'' || || Check your user name || ''whoami'' || || || Convert text files from DOS to Unix || ''dos2unix <filename>'' || || || Edit files || ''nedit'', ''emacs'', ''vi'' || || || Help on linux commands || ''man <yourcommand>'' || turn page using space bar, quit typing ''q'' || |
Line 22: | Line 33: |
|| Execute command from history list: !x, where x is number in history list || | |
Line 25: | Line 35: |
|| Type the beginning of a previously used command, then simultaneously press ''Esc p'' to autocomplete to last used command with same beginning || | |
Line 28: | Line 38: |
|| VNC (http://imaging.mrc-cbu.cam.ac.uk/imaging/UsingVNC): Putty, vncserver –geometry 1280x1024 –name somename vncserver.glx -geometry 1280x1024 -name somename || | || Overview of CBU computing: http://imaging.mrc-cbu.cam.ac.uk/meg/Beginners/MatlabIntroCBU?action=AttachFile&do=get&target=RussellComputing.pdf || || Computing on Intranet: http://intranet.mrc-cbu.cam.ac.uk/computing/ || || Intro to Unix: http://www.ee.surrey.ac.uk/Teaching/Unix/ || || More [http://imaging.mrc-cbu.cam.ac.uk/meg/Beginners computing-related intros] || || Primer on [http://imaging.mrc-cbu.cam.ac.uk/meg/AnalyzingData/Primer_ShellScripting shell scripting] || || VNC (http://imaging.mrc-cbu.cam.ac.uk/imaging/UsingVNC): start Putty, ''vncserver –geometry 1280x1024 –name <somename>, for OpenGL graphics: ''vncserver.glx -geometry 1280x1024 -name <somename>'' || |
Line 31: | Line 46: |
|| 32-bit machines: l21, l24-31, l33-l36, l37-l42 64-bit machines: l43-l63 OpenGL machines: l37-l42 || || Computing on Intranet: http://intranet.mrc-cbu.cam.ac.uk/computing/ || || Intro to Unix: http://www.ee.surrey.ac.uk/Teaching/Unix/ || || Overview of CBU computing: http://imaging.mrc-cbu.cam.ac.uk/meg/Beginners/MatlabIntroCBU?action=AttachFile&do=get&target=RussellComputing.pdf || |
|| 32-bit machines: l21, l24-31, l33-l36, l37-l42; 64-bit machines: l43-l63; OpenGL machines: l37-l42 || |
Your Survival Guide to Unix at the CBSU
Commands
Function |
Command |
Options |
Show contents of current directory |
ls |
details: ls –l, hidden files: ls –a, output to file: ls > file.txt, wild cards: ls *.txt |
Change directory |
cd <newdir> |
e.g. cd /home/myname/mydatadir, one up: cd .. (e.g. cd ../batchfiles, to home directory: cd ~) |
Make directory |
mkdir <newdir> |
|
Copy file/directory |
cp <old> <new> |
Copy directories: cp -r <old> <new> |
Move file/directory |
mv <old> <new> |
|
Delete file |
rm <filename> |
delete directory: rm –r <dirname> |
Create link between a new filename and an existing file |
ln <filename> <linkname> |
symbolic link: ln -s <filename> <linkname>, to see whether a file is "real" or a symbolic link, use ls -l |
Find letter string within text |
grep |
grep error logfile.txt, ps -ef | grep <yourname> |
See list of previous commands |
history |
|
Execute command from history list |
!<x>, where x is number in history list |
e.g. !112 |
Send output of a command to text file |
> |
e.g. ls -l > listoffiles.txt, >> appends instead of overwriting |
Send output of a command directly to another command ("pipes") |
| |
e.g. grep myfile.txt | ls -l |
Changing access permissions |
chmod |
e.g. chmod 755 <myfile> |
Show load of linux boxes |
showload |
|
Change linux box |
ssh <machine> |
e.g. ssh l42 |
Show current processes |
ps |
ps -ef |
Show most CPU-intensive tasks on current processor |
top |
|
Checking where an executable file is located |
which <filename> |
|
Show features of current linux box |
uname |
uname -a |
Check your user name |
whoami |
|
Convert text files from DOS to Unix |
dos2unix <filename> |
|
Edit files |
nedit, emacs, vi |
|
Help on linux commands |
man <yourcommand> |
turn page using space bar, quit typing q |
Useful Tricks
Use cursor keys up/down to get previous commands |
Copy/paste: mark text with left mouse button, click to destination, click middle mouse button |
Auto-complete commands: start typing, then “Tab” to complete to next unique possibility |
Type the beginning of a previously used command, then simultaneously press Esc p to autocomplete to last used command with same beginning |
General
Overview of CBU computing: http://imaging.mrc-cbu.cam.ac.uk/meg/Beginners/MatlabIntroCBU?action=AttachFile&do=get&target=RussellComputing.pdf |
Computing on Intranet: http://intranet.mrc-cbu.cam.ac.uk/computing/ |
Intro to Unix: http://www.ee.surrey.ac.uk/Teaching/Unix/ |
More [http://imaging.mrc-cbu.cam.ac.uk/meg/Beginners computing-related intros] |
Primer on [http://imaging.mrc-cbu.cam.ac.uk/meg/AnalyzingData/Primer_ShellScripting shell scripting] |
VNC (http://imaging.mrc-cbu.cam.ac.uk/imaging/UsingVNC): start Putty, vncserver –geometry 1280x1024 –name <somename>, for OpenGL graphics: vncserver.glx -geometry 1280x1024 -name <somename> |
Access home space: Windows \\home\username; Linux /home/username |
Access imaging space: Windows \\samfs-lh\imaging; Linux /imaging/username |
32-bit machines: l21, l24-31, l33-l36, l37-l42; 64-bit machines: l43-l63; OpenGL machines: l37-l42 |