Linux Survival Commands

I Moving, Removing and Creating

I - print working directory I - list files I $ ls -l long format I $ ls -a show all hidden files

I - change directory I $ cd go to home directory I $ cd .. go up one directory I $ cd adir/bdir go to directory adir/bdir

I - copy a file I $ cp from to file copy one file into another I $ cp -r from dir to dir recursively copy one directory into another

I - move or rename a file I $ mv from file to file rename a file, destructive

I - remove a file I $ rm filename removes filename

I - a directory I $ mkdir creates directory dirname Survival Commands

Printing

I a2ps - pretty print a text file a2ps highlights keywords, , comments and constants have a different color or font style. If it knows the (programming) language in your file is written, it will try to make it look on paper. I $ a2ps file2print default format, 2up, border, headers I $ a2ps -r --columns=1 -l=132 myfile -P prntrname wide, 132 char width I $ a2ps file2print -o outfile. send output to a file I $ card file2print -o outfile.ps FIX ME AND POPULATE

I lp - dumb printing Linux Survival Commands

Finding, Checking

I - a file I $ find . -name myfile -print start here, search for ”myfile” I $ find / -name "*ECE*" -print start /, search for files with ”ECE” in them I $ find /bin -mmin -10 -print search in /bin for files that changed than 10 minutes ago I less - view contents of a text file I $ less file2read view contents of text file file2read I - view first 10 lines of a text file I $ head -n 20 file2read view first 20 lines of file2read I - view last 10 lines of a text file I $ tail -n 20 file2read view last 20 lines of file2read Linux Survival Commands Finding, Checking (cont.)

I - search for a string in a file I $ grep "literal string" file2examine search for string ”literal string” in file2examine and print match lines I $ grep INCLUDE *.c search all .c files for the string INCLUDE I - compare two files and report differences I $ diff file1 file2 compare two files and report differences I man - display manual for a command I $ man command display manual for a command I whatis - brief description of command I $ whatis give brief description of chmod command I - list previous commands I $ history give list of previous commands I - print calendar I $ cal print present month calendar I $ cal 2013 print year 2013 calendar I date - print day, date, , year, timezone I ps - list status I $ ps -ef list all process running on the systemg I $ ps -u username list all process running owned by username I $ ps -ef | grep command list all process running ”command” Linux Survival Commands

Web or Network Operations

I ssh - open secure shell I $ ssh -l jsmith access.engr.orst.edu login jsmith to access.engr.orst.edu I $ ssh -Y -l jsmith access.engr.orst.edu login jsmith, X tunneling enabled I curl - transfer data with URL syntax I $ curl http://www.engr.orst.edu/stuff.pdf > mystuff.pdf get the file stuff.pdf at http://www.engr.orst.edu, save into mystuff.pdf I $ curl -o mygettext.html http://www.gnu.org/software/gettext/manual/gettext.html get gettext.html and save it to mygettext.html I gzip,gunzip - compress or compress a file I $ gzip abigfile compress abigfile, output is abigfile.zip I $ gunzip abigfile decompress abigfile.zip, output is abigfile