29 Linux commands that you must know

Source: Internet
Author: User
Tags disk usage

29 Linux commands that you must know

Although the Linux release supports a variety of graphical user interfaces, in some cases, the Linux command line interface (bash) isSimple and fast. Bash and Linux Shell are called command line interfaces.

Commands are commands used by computers to execute tasks. You can use commands to shut down the computer, or list the file list of the current directory, or the content of the current text, or display a message on the screen.

If you are a newbie and try to use the command line interface, we collect various basic Linux commands for you to learn and help you complete various tasks in various Linux distributions. Although not very detailed, it is very useful for Linux beginners, General fire, or administrators.

1. ls-List

lsThe contents of the current working directory (file or folder) will be listed, just like opening a folder in the GUI to see the content in it.

2. mkdir-Make Directory

mkdir <new-directory-name>A common new directory

3. pwd-Print Working Directory

pwdDisplay current working directory

4. cd-Change Directory

For the session currently running on the terminal,cd <directory>Set the Given folder (or directory) to the current working directory.

5. rmdir-Remove Directory

rmdir <directory-name>Delete the specified directory.

6. rm-Remove

rm <file-name>Will delete the given file or folder, you can userm -r <directory-name>Recursively delete folders

7. cp-Copy

cp <source-file> <destination-file>Command to copy files or folders. You can usecp -r <source-folder> <destination-folder>Options to recursively copy folders.

8. mv-MoVe

mv <source> <destination>Command to move a file or folder. If the file or folder exists in the current working directory, you can also rename the file or folder.

9. cat-concatenate and print files

cat <file>Used to View File Content on standard output (monitor or screen.

10. tail-print TAIL (from last)>

tail <file-name>By default, the last 10 lines of content of a given file are displayed on the standard output.tail -n N <file-name>Specifies the last N lines of the file to be displayed on the standard output.

11. less-print LESS

less <file-name>Print the file content by page or by window. It is very useful and efficient in viewing large files containing large amounts of text data. You can useCtrl + FFlip forward,Ctrl + BFlip back.

12. grep

grep "<string>" <file-name>Search for the specified string in the specified file.grep -i "<string>" <file-name>The case sensitivity of the string is ignored during search, whilegrep -r "<string>" <file-name>The specified string is recursively searched in the current working directory file.

13. Find

This command searches for files matching the conditions at a given location. You can usefind <folder-to-search> -name <file-name>Of-nameOptions for case-sensitive searches,find <folder-to-search> -iname <file-name>To perform case-insensitive searches.

find <folder-to-search> -iname <file-name>

14. tar

tarCommand to create, view, and extract tar compressed files.tar -cvf <archive-name.tar> <file1-OR-file2-OR-both-to-archive>Is to create the corresponding compressed file,tar -tvf <archive-to-view.tar>To view the corresponding compressed file,tar -xvf <archive-to-extract.tar>To extract the corresponding compressed file.

15. gzip

gzip <filename>Command to create and extract gzip compressed files, you can also usegzip -d <filename>To extract compressed files.

16. unzip

unzip <archive-to-extract.zip>Decompress the gzip file. Before decompression, you can useunzip -l <archive-to-extract.zip>Command to view the file content.

17. help

<command-name> --helpAll available commands are listed on the terminal.-hOr-helpTo view the specific usage of the command.

18. whatis-What is this command

whatis <command-name>A single line is used to describe the given command.

19. man-Manual

man <command-name>A manual page is displayed for the given command.

20. exit

exitEnds the current terminal session.

21. ping

ping <remote-host-address>Ping the remote host (server) by sending data packets to detect network connections and server status.

22. who-Who Is logged in

whoLists the usernames currently logged on.

23. su-Switch User

su <username>Used to switch between different users. Super Users can switch to other users even if they do not use a password.

24. uname

unameDisplays important information about the system, such as the kernel name, host name, kernel version, and processor type.uname -aYou can view all information.

25. free-Free memory

freeThe system's idle memory, occupied memory, and available swap memory are displayed,free -mConverts the unit in the result to KB, whilefree –gConvert to GB.

26. df-Disk space Free

dfView disk usage in the file system-used and available storage space of the hard disk and other storage devices. You can usedf -hDisplay the results in a human readable manner.

27. ps-ProcesseS

psDisplays the running processes of the system.

28. Top-TOP processes

topBy default, the command displays processes that occupy a large amount of resources based on CPU usage.top -u <username>View the CPU usage ranking of a user.

29. shutdown

shutdownUsed to shut down the computer, whileshutdown -rUsed to restart the computer.

Related Articles
9 Linux Commands & Codes to be Wary

Practical linux commands (1)

Practical Linux commands (2)

Http://www.ido321.com/1609.html.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.