UNIX Operations
UNIX or LINUX is case sensitive. Therefore the correct case has to be used white giving the command.
Directory Commands
The Pwd Command-
- Purpose – This command is used to display the absolute pathname of the working directory.
- Syntax – $pwd
The mkdir Command-
- Purpose – This command is used to remove a directory.
- Syntax – $mkdir <path name> <directory name>
- Examples – $mkdir mydir
The rmdir Command
- Purpose – This command is used to remove a directory
- Syntax – $rmdir <path name> <directory name>
- Examples – $rmdir mydir
The cd Command
- Purpose – This command is used to change the working directory.
- Syntax – $cd <path name> <directory name>
- Examples – $cd mydir , $cd….
File Commands
The Is Command
- Purpose – The purpose of the command is used to get a listing of the contents of a directory.
- Syntax – $Is (options) <path name> <file name>
- Examples
$Is
$Is – x
$Is – I myprog
The cat Command –
- Purpose – This Command can be used to view the contents of a file or to create a file.
- Syntax – $cat <path name><file name>
- Example –
$cat dept
$cat file.c
$cat > new.txt
The cp Command
- Purpose – The purpose of this command is to copy one or more files.
- Syntax – $cp (options) <path name> <file name>
- Examples
$cp file1 file2
$cp file1 /usr/guest/file2
$cp file1 /usr/guest
$cp file1 file2 file3 /usr/guest
The rm Command
- Purpose – The purpose of this command is to delete one or more files.
- Syntax – $rm (options) <path name> <file name>
- Examples –
$rm file1
$rm file1 file2
The mv Command
- Purpose – The purpose of this command is to move one or more files from one directory to another. This Command can also be used for renaming of files and directories.
- Syntax – $mv (options) <path name> <file name>
- Examples –
$mv file1 file2
$mv file1/usr/guest/file2
$mv file1 /usr/guest
$mv file1 file2 file3/usr/guest
Other Commands
The more Command
- Purpose – This command can be used as a paging tool.
- Syntax – $more (options) <file name>
- Example – $more chap1
The wc Command
- Purpose – This command can be used to count the number of lines words and characters of one or more files.
- Syntax – $wc (options) <file name>
- Examples –
$wc chap1
$wc – chap1 chap2
$wc – w chap3
$wc – I chap1 chap2
$wc – wc chap3
The cmp Command
- Purpose – This command can be used to compare two files. The contents of the two files, which are compared, are shown before the comparison is done.
- Syntax – $cmp (options) <file name1> <file name2>
- Examples –
$cmp chap1 chap2
$cmp -I chap1 chap2
The cal Command
- Purpose – This command is used to display the calendar.
- Syntax – $cal <month> <year>
- Examples
$cal 1999
$cal 11 1999
The date Command
- Purpose – This command can be used to view the system date.
- Syntax – $date (options)
- Examples
$date
$date + %d
$date + %m%d
The who am i Command
- Purpose – This command is used to display the login details of the user who issued the command.
- Syntax – $who am i
- Examples
$who am i
$whoami
$who
$w