This is a selection of commands that are very useful for me when I'm working in Linux environment. I hope this will be also useful for you.

Unix / Linux


 Linux (Unix)  commands:
Command line Purpose Command line Purpose
ls -a List files and folders (even hidden ones) dos2unix [filename] Gives unix format to [filename]
ps -A Shows all processes foreach file(*)
dos2unix $file
Transform all the files in the subdirectory to unix format. May not work in Linux.
ps -u [user] Shows processes running of [user] diff [filename1] [filename2] Shows differences in content between [filename1] and [filename2]
du -s Show quota grep -r 'text' [filename] Search for 'text' inside files (recursive)
cp -r [folder] [path] Copy folder and its content to the path ssh -l username hostname Access to server in ssh mode
split -b -d [bytes] [filename] split files sftp [user]@ftp.[server] Access to server through ftp mode
kpdf [filename] open pdf viewer mget [filename] from sftp -> local server
ooffice [filename] Opens Openoffice put [filename] local server -> sftp
oocalc [filename] Opens Opencalc find ./ -name 'file.ext' -exec rm '{}' + Remove from multiple files
mail -s "text" [e-mail] < file Send mail with attached file in the body of the mail. find . -name [name]\* Find files with [name] letters
mutt -s "Test mail" -a
Send mail with attached  in archive format. find ./ -name '*.ext' Finds multiple files
tar -xsf [filename].tar.gz Make "tar" file find -name [filename] Indicate location of certain file (recursive)
tree -L 1 List the directories and files in the current directory. Below is an example of what this may look like.
write [user] Tty
Chat using terminal.. Tty is get using "finger"
ctrl+D = finish
last Login history ac -dp Other way to see login history
find . -name "[part of filemane]*" -type f Search for filenames with the indicated filename awk '!x[$0]++' file >
Remove Duplicate Lines in File
history View previous commandssort -u filename >
If the files are not already sorted then:
sed -i 's/[original text]/[newtext]/g' [filename] Replace text in multiple files
perl -pi -e 's/[original text]/[newtext]/g' 'find . -name [filename] Replace content of files in folder and sub-folders
find . -name 'filename' | xargs perl -pi -e 's/[original text]/[newtext]/g' Replace text in multiple files
chmod * = **
(or "chmod -R * = **"  recursive)
*  -> "o" (i.e. other)
"a""o" (i.e. all)
"u" (i.e. user)
"g" (i.e. group)
** -> "r" (i.e. read)
"w" (i.e. write)
"x" (i.e. execute)
gconftool-2 --type list --list-type string --set /system/storage/default_options/ntfs/mount_options '[umask=2,uid=,gid=]' Change permissions to access to an external hard drive
find . -name '*.html' | xargs perl -pi -e 's/oldtext/newtext/g'Find and replace
find /home/you -iname "*.txt" -mtime -60 -printFind files within 60 days
grep -v '[text in line]' [source filename] > [out filemane]write output file removing line/s with [text in line]
Vi commands
:g/^$/dRemove blank lines

Useful links:

Nice on-line fortran tutorial:

Vi manual @ Purdue:

Site designed by Federico C. Antico
Last update 08/26/2013