Here is a list of commonly used Linux commands as a headstart for the beginner or as a reference for everyone else. It has been a while that we published a series of how-to’s in Linux scripting. Very useful for people who passed beginner-status. This post is not a how-to, but a basic list of examples for commonly used Linux commands.
Commonly Used Linux Commands
$ tar cvf archive_name.tar dirname/ $ tar xvf archive_name.tar $ tar tvf archive_name.tar # find -iname "MyCProgram.c" $ find -iname "MyCProgram.c" -exec md5sum {} \; # find ~ -empty ssh -l johndoe remotehost.example.com ssh -v -l johndoe remotehost.example.com $ sort places.txt $ sort -r places.txt $ sort -t: -k 3n /etc/passwd | more $ export | grep ORACLE $ export ORACLE_HOME=/u01/app/oracle/product/10.2.0 $ gzip testing.txt $ gzip -d testing.txt.gz $ bzip2 test.txt bzip2 -d test.txt.bz2 $ unzip test.zip $ ftp IP/hostname ftp> mls *.html - $sed 's/.$//' filename $ sed -n '1!G;h;$p' jaxov.txt $ sed '/./=' jaxov.txt | sed 'N; s/\n/ /' Did we miss your favorite Linux commands? Let us know, so we can make a second list of commonly used Linux commands.Create a New tar Archive
Extract from an Existing tar Archive
View an Existing tar Archive
Find Command Examples
Find Files Using file-name ( case in-sensitve find)
Execute Commands on Files Found by the Find Command
Find all Empty Files in Home Directory
SSH Command Examples
Login to Remote Host
Debug SSH Client
Sort Command Examples
Sort a File in Ascending Order
Sort a file in descending order
Sort Passwd File by 3rd Field
Export Command Examples
To View Oracle Related Environment Variables
declare -x ORACLE_BASE="/u01/app/oracle"
declare -x ORACLE_HOME="/u01/app/oracle/product/10.2.0"
declare -x ORACLE_SID="med"
declare -x ORACLE_TERM="xterm"To Export an Environment Variable
GZIP Command Examples
To Create a *.gz Compressed File
To Uncompress a *.gz File
BZIP2 Command Examples
To Create a *.bz2 Compressed File
To Uncompress a *.bz2 File
Unzip Command Examples
To Extract a *.zip Compressed File
FTP Command Examples
Both ftp and secure ftp (sftp) have similar commands. To connect to a remote server and download multiple files, you can do the following.
ftp> mget *To view the file names located on the remote server before downloading, mls ftp command as shown below.
/ftptest/products.html
/ftptest/index.html
/ftptest/othertools.html
/ftptest/sampleproduct.html
/ftptest/usage.htmlSED Command Examples
When you copy a DOS file to Unix, you could find \r\n in the end of each line. This example converts the DOS file format to Unix file format using sed command.
Print File Content in Reverse Order
Add Line Number for all Non-empty-lines in a File
Did We Miss Any Commonly Used Linux Commands?