29 Linux Commands you must know

Source: Internet
Author: User
Tags cpu usage disk usage

While Linux distributions support a wide variety of hungry GUI (graphical user interfaces), in some cases, the command line Interface (bash) of Linux is still simple and fast . Bash and Linux shells are called command-line interfaces because they need to enter commands to complete the task.

Commands are instructions for a computer to perform a task. You can use commands to turn off your computer, or to list the file lists of the current directory, or the contents of the current text, or to display a message on the screen.

If you are a novice and try to use the command line interface, we have collected a variety of basic Linux commands for you to learn and help you accomplish various tasks in various Linux distributions. Although not very detailed, but for Linux beginners, or common with fire, or administrators are very useful.

1.ls–list

lsLists the contents (files or folders) of the current working directory, just as you would open a folder in the GUI to see what's inside.

2.mkdir–make Directory

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

3.pwd–print Working Directory

pwdShow Current working directory

4.cd–change Directory

For the current run at the terminal, set the cd <directory> given folder (or directory) to the current working directory.

5.rmdir–remove Directory

rmdir <directory-name>Deletes the given directory.

6.rm–remove

rm <file-name>Deletes a given file or folder and can use rm -r <directory-name> recursion to delete a folder

7.cp–copy

cp <source-file> <destination-file>command to copy a file or folder, you can use the cp -r <source-folder> <destination-folder> option to recursively copy the folder.

8.mv–move

mv <source> <destination>command to move a file or folder, or rename a file or folder if the file or folder exists in the current working directory.

9.cat–concatenate and print files

cat <file>Used to view the contents of a file on a standard output (monitor or screen).

10.tail–print tail (from the last) >

tail <file-name>By default, the last 10 rows of a given file are displayed on standard output, and the tail -n N <file-name> last n rows of the file can be displayed using the specified output.

11.less–print Less

less <file-name>Print the contents of a file by page or by window. It is useful and efficient to view large files that contain large amounts of text data. You can use ctrl+f to page forward andctrl+b to page back.

12.grep

grep "<string>" <file-name>Searches for the specified string in the given file. The grep -i "<string>" <file-name> case of the string is ignored while searching, and the grep -r "<string>" <file-name> specified string is searched recursively in the file in the current working directory.

13.Find

This command searches for a file that matches the condition at a given location. You can use find <folder-to-search> -name <file-name> the -name option to make a case-sensitive search, find <folder-to-search> -iname <file-name> to make a case-insensitive search.

<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, which can also be used gzip -d <filename> to extract compressed files.

16.unzip

unzip <archive-to-extract.zip>Unzip the gzip document. You can use commands to view the contents of a file before extracting it unzip -l <archive-to-extract.zip> .

17.help

<command-name> --helpAll available commands are listed at the terminal, and you can use any command -h or -help option to view the specific usage of the command.

18.whatis–what is the 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

exitUsed to end the current terminal session.

21.ping

ping <remote-host-address>Ping a remote host (server) by sending a packet, commonly used to detect network connections and server status.

22.who–who is logged in

whoCan list the currently logged in user name.

23.su–switch User

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

24.uname

unameDisplays important information about the system, such as the kernel name, hostname, kernel version, processor type, and so on, which uname -a can be used to view all information.

25.free–free Memory

freeDisplays information such as the system's free memory, occupied memory, available swap memory, and converts the free -m units in the result to KB, and then to free –g GB.

26.df–disk Space Free

dfView disk usage in the file system – the hard disk is used and available storage space, and other storage devices. You can use the df -h results in a human-readable way to display them.

27.ps–processes

psDisplays the running process of the system.

28.top–top processes

topThe command defaults to the CPU usage, showing a larger process, which can be used to top -u <username> view the CPU utilization ranking of a user.

29.shutdown

shutdownUsed to shut down the computer and to restart the shutdown -r computer.

related articles
9 Linux Commands & Codes to be wary of

Practical Linux commands (i)

Practical Linux Commands (ii)

Source: http://www.ido321.com/1609.html

29 Linux Commands you must know

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.