Data Analysis ============= join Joins two files in a logical way. Can be used to take intersection or union of data. -1 -a 1 include all entries of file 1 -a 2 include all enteries of file 2 -a 1 -a 2 include all entries of both files (Union of two files) sort Sort text --key=n Use column n as the sort key -n Sort numerically paste puts two files togather by brainlessly joining lines cut -f1,2 -d' ' cut out column 1 and 2 from space seperated lines of a file Can also specify the bytes that you want printed. uniq Kills non unique lines in a file (only consecutive lines) merge merge changes seq seq 1 13 with print characters 1 through thirteen (inclusive) nl Number lines (prints a text file with its lines numbered) Network ======= id display your system ID numbers mesg Check or change message status Can so just mesg to check status and msg y or msg n to turn on or off respectively. finger Get information about a user talk A chat utility. Still not sure how to use. who Get list of online users write < user> Send a message to a user. Exit using ^C Can be used as echo "my message" | write whoami Find the login name of current shell. Agood link on find is: http://www.linuxpowered.com/html/editorials/find.html w Used to find out what a user is running. Similar to top but is non-interactive last Used to parse the user login log. Can use as last -3 to find last three logins to the host su switch a user. su assumes switch to root. Another username can be specified as su - suleman Disk Management =============== du Find disk usage of a directory. Mostly used as du -kh . returns disk usage of current directory and its subdirectories in humanreadable format du -khs Does not print each individual subdirectory usage as -kh df Provides information regarding the available disk space to which you have access df -kh can be used to find all the disk spaces that you have access and their stats df -kh can be used to find the disk space available in that directory File Management =============== chmod Change file permissions chmod 700 makes it only author accessible chmod 755 makes it web chmod +x makes a file executable by all users find Can be used to look for a file. Another use is to list all the files in a directory tree and performs a loop on them. There is also a -exec option that can be used to execute a given command for everysingle file found by find. wc Count words, lines, or characters in a file wc -l counts the number of lines wc returns lines, word, and byte count An interesting feature is that is you write wc then the ouput is 13411 Which does not allow stuff like set i = `wc -l my-file.txt` For such operations, use cat my-file.txt | wc -l ln -s Make a softlink between the destination and the source diff Find differences between two files patch Patch takes a patch file patchfile containing a difference listing produced by the diff program and applies those differences to one or more original files, producing patched versions. Never used this one. cat/tac cat prints a file tac prints a file in reverse order cat -n prints a file with line numbers touch Changes access or time modififed of a file Can be used to create empty new files rename Rename files by substituting pattern2 for pattern1 in the file name rename aater suleman aater.txt will change the name of the file aater.txt to suleman.txt Computation =========== bc A basic calculator. Handles only integers by default but the number of decimal places can be set using scale. Very usefule in stuff like set pi = `echo " scale=4; 22 / 7 " | bc ` calc A complication calculator. Never used this one. Obj files handling ================== split Split a file in rows objdump Get the code footprint, disassembly etc for an obj or executable use as objdump -d my-file.o hexdump Gives hex values of a file ldd Find out the dynamic libraries being loaded by a binary Organiztion =========== cal Prints a calender cal prints a calender of the current month cal 06 2005 print calender of June 2005 calender Reads the ~/.calendar file for events and prints the events schduled for today and tomorrow. calender - can be used to send reminders in emails -- never used this one Other ===== autoexpect Can be used in a session to record activity and generate an expect script. Can be very useful in automating tasks that need user responses etc. Command line Text Processing ============================ sed The only thing I really use it for is command line substitution and its very powerful for that. echo | sed 's/myname/yourname/g' can substitute all instances of nyname into your name in file. perl You can use perl on the command line in a very powerful fashion. perl -ne '' can be used to process a file on line-by-line basis. Each line is sent to perl as $_ perl -ane '' maens that lines are sent is not only as $_ but also as @F when they are split on spaces awk Very powerful and requires a tutorial for itself Can be invoked as awk '' fmt expand fold look /grep basename dirname format yes Prints its argument on command line until interrupted. Prints y is no argument given. Display ======= xlock Lock the display script Record everything that is typed or printed on the terminal by programs. The output goes to a text file called typescript in the current directory when script is turned off using ^D. xwd Used to grab a screenshot in the xwd format. Use convert to change this to jpg etc. Utilities ========= rehash rehash all the variables like path etc. eval eval can be used to make a command execute again. Can be used for stuff like units Can be used to convert units Web === wget download a webpage or an entire site. Has a recursive option where the depth can also be specified. Have used this but long time ago. whois get information regarding a domain Graphics ======== eog A graphics viewer called Eye of gnome convert Covert from one picture format to another xv/gv Viewers. Can also open ps/pdf files. Process Management ================== watch Run a command periodically uptime Prnt the time terminal has be on nohup Run a process such that it runs even if the user logs out repeat Repeat a command at Runs a command at specific times screen Screen terminal emulator. Can be used to save, swtich, and resume, terminals just like workspaces. Use C-a to starta new window Use C-a [widnows number] to go that window Use C-d to terminate a screen windows Use C-a ? for help crontab Schedule commands to run at specific time Use command crontab -e to schedule a job The format is A '*' means that the field can take any value A '-' can be used to specify a range of values the field can take A ',' can be used to specify a list of values the field can take pstree list the processes in a tree format. pgrep grep the running programs (ps | grep) mkfifo make named pipes in linux. Admin ===== sshd httpd Shell Variables =============== I/O Redirection =============== >, >>, < Simple redirections > and < mean output and input respectively >> means output but appends to the current file, if it exists. It no,t it creates a file. STDERR tcsh: |& Pipe STDERR and STDOUT >& save STDOUT and STDERR in a file bash: 2> file 2>&1 STDERR goes to STDOUT 2>>file Append STDERR to file tee tee is a powerful commands that can be used to displaywhat is being written to a file at the same time. echo "the text from the program" | tee the_name_of_file_to_save Will print the output from echo in the screen and also save it in a file