Shell Commands: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 19: | Line 19: | ||
grep -3 Stress runs/mo-example/A.log |
grep -3 Stress runs/mo-example/A.log |
||
grep -w mea Fortran/MEAM-Baskes/meam/* |
grep -w mea Fortran/MEAM-Baskes/meam/* |
||
'''head''' to show the first several lines of the file |
|||
head -n 20 runs/mo-example/A.log #view the first 20 lines |
|||
head -n -20 runs/mo-example/A.log #ignore the last 20 lines |
|||
'''nm''' to list symbols from object files |
'''nm''' to list symbols from object files |
||
| Line 25: | Line 31: | ||
'''sed''' to read the input file line by line |
'''sed''' to read the input file line by line |
||
sed -n -e 10p -e 20p runs/mo-example/A.log |
sed -n -e 10p -e 20p runs/mo-example/A.log #view the 10th and the 20th lines |
||
sed -n 10, 20p runs/mo-example/A.log |
sed -n 10, 20p runs/mo-example/A.log #view the lines from 10th to 20th |
||
'''tar''' the tar archiving utility |
'''tar''' the tar archiving utility |
||
Revision as of 16:16, 5 April 2012
( in alphabetical order )
cd to change your current directory Go to your home directory
cd ~
Go to a specified directory, e.g.
cd /tmp
You can use
cd -
to toggle between two directories with no effort at all.
find to search for files in a directory hierarchy
find ./ -name param.inc
grep to show lines matching a pattern from files
grep EPOT runs/mo-example/A.log grep -3 Stress runs/mo-example/A.log grep -w mea Fortran/MEAM-Baskes/meam/*
head to show the first several lines of the file
head -n 20 runs/mo-example/A.log #view the first 20 lines head -n -20 runs/mo-example/A.log #ignore the last 20 lines
nm to list symbols from object files
nm Fortran/MEAM-Baskes/meam/linux/forces.o | grep phiid
sed to read the input file line by line
sed -n -e 10p -e 20p runs/mo-example/A.log #view the 10th and the 20th lines sed -n 10, 20p runs/mo-example/A.log #view the lines from 10th to 20th
tar the tar archiving utility
tar -zxvf MD++.tar.gz tar -jxvf highlight-2.6.5.tar.bz2 tar -cvzf foo.tar.gz foo tar -cvjf foo.tar.bz2 foo tar cvf MD++.tar MD++ --exclude MD++/runs --exclude MD++/scripts/work --exclude MD++/cookies --exclude ".svn"
$ tar --create --tape-length=2097152 --file=results-NACL2-1.tar results-NACL2 Prepare volume #2 for `results-NACL2-1.tar' and hit return: n results-NACL2-2.tar Prepare volume #2 for `results-NACL2-2.tar' and hit return: Prepare volume #3 for `results-NACL2-2.tar' and hit return: n results-NACL2-3.tar Prepare volume #3 for `results-NACL2-3.tar' and hit return: Prepare volume #4 for `results-NACL2-3.tar' and hit return: n results-NACL2-4.tar Prepare volume #4 for `results-NACL2-4.tar' and hit return:
yum (Yellowdog Updater Modified) update program
yum search gcc yum list installed | grep python-numeric yum remove python-numeric.i386 yum install python-numeric.i386 yum check-update gcc.i386 yum update gcc.i386 yum info gcc.i386
diff -b Can be used to compare two files when the tabbing and whitespace has been changed in a code (tabbing, blank lines, spaces, etc). Regular diff will state that 'a=b' is different than 'a = b'.