Question: ls 1. $ ls 2. $ ls lrt or $ ls -ltr 1. It lists files in the current directory. 2. It lists files in
| ls | 1. $ ls 2. $ ls lrt or $ ls -ltr | 1. It lists files in the current directory. 2. It lists files in the long format. |
| cd | 1. $ cd 2. $ cd test 3. $ cd .. (after cd space needs to be given before entering two dots.) | 1. It changes directory to your home directory. 2. It changes directory to test. 3. It moves back to one directory or to the parent directory of your current directory. |
| mkdir | $ mkdir test | It creates a directory called test. |
| rmdir | $ rmdir test1 CAUTION: Be careful while using this command. | It removes directory test1. |
| cp | 1. $ cp file1 test 2. $ cp file1 file1.bak | 1. It copies file1 to test directory. 2. It takes backup of file1. |
| rm | $ rm file1 CAUTION: Be careful while using this command. | It removes or deletes a file1. |
| mv | $ mv file1 file2 | It moves or renames file1 to file2. |
| more | $ more | It checks or display one page at a time. |
| touch | $ touch test | It creates an empty file called test. |
| cat | 1. $ cat File1 2. $ cat test1 > test2 | 1. It displays contents of File1. 2. It creates a new file test2 with the contents of test1. |
| date | $ date e.g. Output: Tuesday, September 12, 2017 06:58:06 AM MDT | It displays current date and time. |
| diff | $ diff file1 file2 | It displays line by line difference between file1 and file2. |
| who | $ who | It lists the users those who are logged in on the machine. |
| grep | 1.$ grep Hello file1 2.$ grep c Hello file1 | 1. It searches for the lines containing Hello in file1. 2. It gives count or number of lines that contains Hello in file1. |
| man | $ man ls | It displays online manual or help about ls command. |
| pwd | $ pwd | It displays present working directory. |
| ps | $ ps | It displays the list of processes which are currently running on the machine. |
| wc | $ wc file1 | It counts the number of lines, words and characters in file1. |
| chmod | $ chmod 744 file1 | It changes the permissions of file1 & assigns this permission rwxr--r-- |
| gzip | $ gzip file1 | It compresses the file1. After compression file1 should look like this, file1.gz |
| gunzip | $ gunzip file1.gz | It uncompresses the file1.gz. After uncompression file1.gz should look like this, file1 |
| history | $ history | It lists all the commands which are recently used. |
| logname | $ logname | It prints log name of the user. |
| uname | $ uname | It gives information about unix system which you are using. |
| tty | $ tty | It displays the device name of your terminal. |
| sort | $ sort file1 | This will sort the contents of file1 and displays sorted output on the screen. |
| head | $ head -15 file1 | It displays first 15 lines of the file. |
| tail | $ tail -15 file1 | It displays last 15 lines of the file. |
| df | $ df | This command is used to check the free disk space |
| cmp | $cmp file1 file2
| it compares two files byte by byte and displays the very first mismatch |
Run all above command on Linux terminal and create word document along with commands and its output screenshot
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
