Pages

12 August 2018

UNIX - Basic UNIX commands with Examples


Below are the basic UNIX commands which are frequently used in ETL Testing and are often asked in interviews :-

1.)  ls
ls command is used for listing of files in a directory.

Example:

ls












2.) cat
cat command is used for displaying the contents in a file.

Example:












3.) cd
cd command is used for changing from one directory to another directory.

Example:







4.) touch
touch command is used for creating zero byte file or empty file.

Example:










5.) cp
cp command  is used to copy the contents of source file into target file.

Example:







6.) mv
mv command is used to move files from one directory to another directory. It is also used for renaming files

Example:










7.) rm
rm command is used to remove or delete files.

Example:









8.) mkdir
mkdir command is used to create directories for organizing files.

Example:








9.) head
head command is used to print first n number of lines from the file.  By default, it displays first 10 lines from each file.

Example:




















10.) tail
tail command is used to print last n number of lines from the file.  By default, it displays last 10 lines from each file.

Example:




















11.) wc
wc command is used to find number of lines, words and characters in a file.

Example:













12.) grep
grep command print lines in files that match patterns.

Example:








13.) pwd
pwd command prints current working directory

Example:








14.) chmod
chmod command is used to change the permission of file or directory.

Example:








15.) man
man command displays the manual page for a given command.

Example: man ls