0% found this document useful (0 votes)
8 views4 pages

Important Linux Command

This document provides a comprehensive list of important Unix commands, including file and directory management, navigation, and system information commands. It covers basic operations such as listing files, changing directories, creating and removing files and directories, and using the sudo command for administrative tasks. Additionally, it includes commands for editing configuration files and managing archives with tar.

Uploaded by

Hồng Anh Tạ
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views4 pages

Important Linux Command

This document provides a comprehensive list of important Unix commands, including file and directory management, navigation, and system information commands. It covers basic operations such as listing files, changing directories, creating and removing files and directories, and using the sudo command for administrative tasks. Additionally, it includes commands for editing configuration files and managing archives with tar.

Uploaded by

Hồng Anh Tạ
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Important Unix Command (Compiled by JP Aggarwal)

1. To List Files and Directory

$ ls

2. Formatted Listing with hidden Files

$ ls -al

3. Change Directory to dir

$ cd dir

$ cd Raspberry\ Pi (to change to “Raspberry Pi” directory)

4. Learn to use Tab key in cd commad


5. Change to HOME Directory

$ cd

$ cd .. (parent)

6. To show present /current working directory

$ pwd

7. Understanding Prompt structure: If there is “/” sign than you are in root directory
8. Understanding Prompt structure: If there is “~” sign than you are in /home/”user name” directory
9. To create directory dir

$ mkdir dir

10. Create nested directories using one mkdir command. If any of these directories exist already, it will
not display any error. If any of these directories doesn’t exist, it will create them.
$ mkdir -p dir1/dir2/dir3/dir4/

11. To remove DIRECTORY / delete file

$ rmdir dir

$ rm filename

12. To remov-e a Directory and its subdirectory / files

$ rm –r dir

13. Copy contents of file1 to file2

$ cp file1 file2

14. Copy dir1 to dir2. Create dir2 if not present

$ cp –r dir1 dir2

15. Rename file1 to file2

$ mv file1 file2

16. To view contents of file1

$ cat file1

17. To create a new blank file

$ touch [Link]

18. To locate a file


$ locate –i *my*name

19. What is the default root password on Ubuntu ?


By default root account is locked under Ubuntu Linux. Therefore, you cannot log in as root or use
‘su -‘ command to become a superuser. To run all administrative command use the sudo
command on Ubuntu. sudo allows a permitted user to execute a command as the superuser or
another user.

$ sudo apt-get ….

20. Change permission of the file (Owner, group and others)

$ chmod octal file

4 – read

2- Write

1 – Execute

21. To create symbolic link link to file

$ ln –s file link

22. Editing of .bashrc file

$ cd

$ nano .bashrc

$ source .bashrc

23. Grep Command (Search for a pattern in file)

$ grep pattern file


24. Create a new tar archive.

$ tar cvf archive_name.tar dirname/

25. Extract from an existing tar archive.

$ tar xvf archive_name.tar

26. View an existing tar archive.

$ tar tvf archive_name.tar

Others
a) Ifconfig (get the inet address) … followed by cmd (ping inet address)
b) Clear (Clear screen )
c) uname –a (all system info), -r (recursive)
d) sudo apt-get install / update / upgrade
apt-get update && apt-get upgrade
e) ping [Link]
f) ctrl + c or ctrl +z (to terminate)
g) history

You might also like