Common commands in Linux

Source: Internet
Author: User
Tags dmesg
Linux Common commands original address: http://www.cnblogs.com/Gaojiecai/archive/2011/11/03/2234888.html

=============== Installation and login commands ================================== ========================

Mount: mount command. Specify the storage medium as a directory in the system. For example, mount the optical drive Mount/dev/CDRom and mount the CDROM. You can view the content under the/mnt/CDROM directory.

Umount: uninstall command, such as umount/dev/CDROM
Exit: exit the terminal command.

ShutdownLinuxSystem. parameters can be added later, such as shut down now.

Reboot: restartLinux.

Halt: hangs the system, but does not shut down.

CHSH: Change the shell used to log on to the system.

TTY: displays the file name of the standard input device for terminal connection.
=============== File Processing Command ==================================== ======================

Ls: displays the content of the current directory. You can add a parameter path to display the content of a specified directory, or a specific root directory. Add-L to display the details of files in the directory, such as permissions, and add-all to display the most detailed information. Add | more: displays the directory file information on a split screen. Press enter to follow up and SHIFT + page up/down to flip the page.

Find: Find the file. The format is find.-Name "*. Java" or find.-Name \ *. Java, where "." indicates the current directory, "-name" indicates the search by name, and "*" indicates the wildcard.

RM: delete a directory or file. Add the parameter-RF to force recursion to delete a non-empty directory. For example, to recursively Delete the target file under the current file, use:

Find.-Name *. O-type F-exec Rm-F {}\;

CD: enter a directory. Add a parameter to indicate the path,/to indicateLinuxRoot directory; Cd ~ Return the user directory under home; CD .. return to the upper directory.

CP: Copy command. Add a parameter to indicate the object to be copied and the target directory. CP 1.txt usr/local/armbeibei.com directory to the target directory.

./: Execute the Current Directory ApplicationProgram, Followed by the Application name as a parameter.

Cat: view the content of a file, followed by the file name. If the file content is longer than rolled over the screen, run the cat file name | less command to view the content and move the up/down key. You can also viewLinuxUse CAT/proc/version to view memory information, use CAT/proc/meminfo to view sound card information, and use CAT/proc/asound/cards. Another function is redirection. For example, the cat> file name is to redirect the cat output to the file after the> and overwrite the file. If it is understood as a wide-definition redirection, cat **. wav>/dev/snd/DSP, or cat **. wav>/dev/snd/audio, enable playing audio files; CAT/proc/asound/OSS/sndstat view OSS configuration information; CAT/proc/asound/version view ALSA version. You can also view the interrupt distribution information: CAT/proc/interrupts.

More: similar to CAT, but it will be displayed on one page for users to read on one page, and the most basic instruction is to press the Space key to display on the next page, press the B key to display the back page.

Mkdir: Directory Creation command. For example, mkdir dirname: the directory named after dirname is created under the current directory, or the directory under the existing directory path is created at a lower level. Multi-Level directories cannot be created at a time.

DIFF: Compares two text files row by row to list how different values are consistent. For example: Diff file1 file2, obtain N1, N2 C N3, N4. N1n2 indicates several rows of the first file and n3n4 indicates several rows of the Second file. The letter A in the middle refers to "add", "D" refers to "delete", and "C" refers to "modify.

Make menuconfig: configure system kernel parameters on the GUI.

MV: Move or rename a file or directory. MV name1 PPP, rename name1 to PPP, and MV name1/usr/move the file to the target directory.

Apt-Get: used to automatically find and install software and update software. Generally, the root permission is required. The format is sudo apt-Get install (installation), sudo apt-Get remove (uninstallation), and sudo apt-Get upgrade (upgrade)

Fgrep: a global search command, such as a specific text string, to search for a specific string text in all the text in a specific directory: fgrep "unable to install HW Params" external/ALSA-lib/*-R. Similar to grep.

|: Pipeline command. Generally, the command output on the left of the pipeline is used as the command input on the right of the pipeline.

Head: view the first few lines of the file, for example, view the first five lines of the file head-5/etc/passwd.

Tail: view the last few lines of the file, for example, the last 10 lines of the file, tail-10/etc/passwd.

Alsa_aplay: Command for playing test sound, alsa_aplay xxx.wav.

Alsa_amixer: mixer information and commands.

Alsa_alsactl: ALSA control.

Arecord: add the-l parameter to list the current digital audio devices, and add-L to list the current PCM devices. Arecord-d the device name xxx.wav can be recorded.

=============== System management commands ==================================== ======================

PWD: displays the complete current working directory.

Source: it is usually used to re-execute the modified initialization file to make it take effect immediately without logging out and logging on again. For example, after modifying the environment variable configuration, run source ~ /. Bashrc.

Ls Dev: displays system devices.

DF: displays the current system disk usage.

Top: displays the resource status, similar to the resource manager of XP.

Free: displays the system memory usage.

At: perform specific operations at a specified time.

Adduser: Add a user to the home directory.

Useradd: it is a thing with adduser.

Groupadd: Create a new group.

Unzip: Decompress the ZIP file.

Gzip: compress the file into a. GZ file.

Gunzip: Decompress the. GZ file.

Last: lists information related to users currently logged on to the system.

Lspci: Use lspci-V to view the hardware chipset.

Lsusb: displays the system USB bus device information.

Lsmod: displays information about modules loaded by the system.

Uname: view system hardware and software information. Use uname-r-m-p-I to obtain kernel version, CPU architecture, and other information.

Insmod: loading module,LinuxMany functions are loaded into the kernel only when necessary through the module method.

Rmmod: uninstall the module.

Rpm: similar to "Add/delete programs" in Windows, it is widely used inLinuxInstall and delete software. For example: rpm-Q modutils, check whether the system contains the modutils software package.

DF: hard disk space usage and mounting information.

Mplayer: Use This toolkit to debug and use sound. Mplayer xxx.wav, which plays audio files and displays the devices used for the current audio. Of course, you can also specify OSS or ALSA for playing, for example, mplayer-ao ALSA xxx.wav, and ALSA for playing.

Fdisk: displays the mounting and allocation information of a disk, such as sudo fdisk-L. It displays the mount point and purpose. For an IDE hard disk, the device names are/dev/hda,/dev/HDB,/dev/HDC,/dev/HDD, etc. For a SCSI hard disk, the device names are/dev/SDA and/dev/SDB in sequence.

Dmesg: prints kernel information. Some print statements are output to the kernel rather than the terminal.

Lsof: displays all processes that open the file. For example, lsof abc.txt displays the process of opening the abc.txt file.
=============== Network operation commands ==================================== ======================

Service Network restart: After the network service is configured, restart.

IP: integrates the ifconfig and route commands.

Ping: Same as XP. If you want it to stop, use Ctrl + C.

Netstat: The netstat command displays network connection, route table, and network interface information, allowing you to know which network connections are currently in operation.

TELNET: Start the terminal job and log on to the remote host.

Rlogin: remote login, which enables tasks in the terminal stage and logs on to the remote host.

FTP: log on to the FTP server.

Route: displays the current system route table information.

FINGER: displays information about a user in the system, such as the user name, main directory, stagnation time, Logon Time, and logon shell.

Mail: email information.

W3m: Enter the text browser on the terminal.

=============== System security commands ==================================== ======================

Passwd: change the password.

Su: the role is to change the identity of another user. Except for Super Users, you need to enter the user's password.

Umask: determines the default file creation mode. This command is actually the opposite of the CHMOD command. For example, umask 777.

Sudo: a tool that allows the system administrator to allow common users to execute some or all of the root commands, such as halt, reboot, and Su. This not only reduces the login and management time of the root user, but also improves the security.

Chmod: Change the File Permission. For example, set the CC permission to 777 for chmod 777 CC. The first is the file owner permission, the second is the group permission, and the third is the permission of others. Each permission value is the sum of read permission (4) and write permission (2) and execution permission (1.

Chown: Change the owner and group associated with the file. For example, chown Jim program. c, that is, program. the user access permission of C is now applied to Jim; chown-r JOHN: build/tmp/src, and all files under the src directory are associated with user John and the group build.

=============== VI editor command ==================================== ======================

VI editor operation:
Exit: Press ESC, Shift +:, Q. Q! Force exit. After WQ is saved, it exits.
Edit: press I to enter the edit status.
Search: Press ESC to exit the editing mode. Run "/word" to search for the string to be searched, and press "N" to find the next string.
Copy: Press ESC to exit the editing mode. to copy the current row, press YY to jump the cursor to the target row. To copy multiple rows, press YY next to the number of input rows to jump to the starting row.
Paste: Copy and jump to the target position, and press p.

=============== Compression and decompression commands ================================== ========================

Tar: Decompress the command.

.Tar.gz
Decompress: Tar zxvf filename.tar.gz

Compression: Tar zcvf filename.tar.gz dirname compresses the content of dirname into a compressed file named after filename.

.Tar.bz2
Decompress: Tar jxvf filename.tar.bz2

Compression: Tar jcvf filename.tar.bz2 dirname

. Tar

Decompress: Tar xvf filename.tar

Package: Tar CVF filename.tar dirname. This command cannot perform compression.

=============== Installation and login commands ================================== ========================

Mount: mount command. Specify the storage medium as a directory in the system. For example, mount the optical drive Mount/dev/CDRom and mount the CDROM. You can view the content under the/mnt/CDROM directory.

Umount: uninstall command, such as umount/dev/CDROM
Exit: exit the terminal command.

ShutdownLinuxSystem. parameters can be added later, such as shut down now.

Reboot: restartLinux.

Halt: hangs the system, but does not shut down.

CHSH: Change the shell used to log on to the system.

TTY: displays the file name of the standard input device for terminal connection.
=============== File Processing Command ==================================== ======================

Ls: displays the content of the current directory. You can add a parameter path to display the content of a specified directory, or a specific root directory. Add-L to display the details of files in the directory, such as permissions, and add-all to display the most detailed information. Add | more: displays the directory file information on a split screen. Press enter to follow up and SHIFT + page up/down to flip the page.

Find: Find the file. The format is find.-Name "*. Java" or find.-Name \ *. Java, where "." indicates the current directory, "-name" indicates the search by name, and "*" indicates the wildcard.

RM: delete a directory or file. Add the parameter-RF to force recursion to delete a non-empty directory. For example, to recursively Delete the target file under the current file, use:

Find.-Name *. O-type F-exec Rm-F {}\;

CD: enter a directory. Add a parameter to indicate the path,/to indicateLinuxRoot directory; Cd ~ Return the user directory under home; CD .. return to the upper directory.

CP: Copy command. Add a parameter to indicate the object to be copied and the target directory. CP 1.txt usr/local/armbeibei.com directory to the target directory.

./: Run the application in the current directory, followed by the Application name as a parameter.

Cat: view the content of a file, followed by the file name. If the file content is longer than rolled over the screen, run the cat file name | less command to view the content and move the up/down key. You can also viewLinuxUse CAT/proc/version to view memory information, use CAT/proc/meminfo to view sound card information, and use CAT/proc/asound/cards. Another function is redirection. For example, the cat> file name is to redirect the cat output to the file after the> and overwrite the file. If it is understood as a wide-definition redirection, cat **. wav>/dev/snd/DSP, or cat **. wav>/dev/snd/audio, enable playing audio files; CAT/proc/asound/OSS/sndstat view OSS configuration information; CAT/proc/asound/version view ALSA version. You can also view the interrupt distribution information: CAT/proc/interrupts.

More: similar to CAT, but it will be displayed on one page for users to read on one page, and the most basic instruction is to press the Space key to display on the next page, press the B key to display the back page.

Mkdir: Directory Creation command. For example, mkdir dirname: the directory named after dirname is created under the current directory, or the directory under the existing directory path is created at a lower level. Multi-Level directories cannot be created at a time.

DIFF: Compares two text files row by row to list how different values are consistent. For example: Diff file1 file2, obtain N1, N2 C N3, N4. N1n2 indicates several rows of the first file and n3n4 indicates several rows of the Second file. The letter A in the middle refers to "add", "D" refers to "delete", and "C" refers to "modify.

Make menuconfig: configure system kernel parameters on the GUI.

MV: Move or rename a file or directory. MV name1 PPP, rename name1 to PPP, and MV name1/usr/move the file to the target directory.

Apt-Get: used to automatically find and install software and update software. Generally, the root permission is required. The format is sudo apt-Get install (installation), sudo apt-Get remove (uninstallation), and sudo apt-Get upgrade (upgrade)

Fgrep: a global search command, such as a specific text string, to search for a specific string text in all the text in a specific directory: fgrep "unable to install HW Params" external/ALSA-lib/*-R. Similar to grep.

|: Pipeline command. Generally, the command output on the left of the pipeline is used as the command input on the right of the pipeline.

Head: view the first few lines of the file, for example, view the first five lines of the file head-5/etc/passwd.

Tail: view the last few lines of the file, for example, the last 10 lines of the file, tail-10/etc/passwd.

Alsa_aplay: Command for playing test sound, alsa_aplay xxx.wav.

Alsa_amixer: mixer information and commands.

Alsa_alsactl: ALSA control.

Arecord: add the-l parameter to list the current digital audio devices, and add-L to list the current PCM devices. Arecord-d the device name xxx.wav can be recorded.

=============== System management commands ==================================== ======================

PWD: displays the complete current working directory.

Source: it is usually used to re-execute the modified initialization file to make it take effect immediately without logging out and logging on again. For example, after modifying the environment variable configuration, run source ~ /. Bashrc.

Ls Dev: displays system devices.

DF: displays the current system disk usage.

Top: displays the resource status, similar to the resource manager of XP.

Free: displays the system memory usage.

At: perform specific operations at a specified time.

Adduser: Add a user to the home directory.

Useradd: it is a thing with adduser.

Groupadd: Create a new group.

Unzip: Decompress the ZIP file.

Gzip: compress the file into a. GZ file.

Gunzip: Decompress the. GZ file.

Last: lists information related to users currently logged on to the system.

Lspci: Use lspci-V to view the hardware chipset.

Lsusb: displays the system USB bus device information.

Lsmod: displays information about modules loaded by the system.

Uname: view system hardware and software information. Use uname-r-m-p-I to obtain kernel version, CPU architecture, and other information.

Insmod: loading module,LinuxMany functions are loaded into the kernel only when necessary through the module method.

Rmmod: uninstall the module.

Rpm: similar to "Add/delete programs" in Windows, it is widely used inLinuxInstall and delete software. For example: rpm-Q modutils, check whether the system contains the modutils software package.

DF: hard disk space usage and mounting information.

Mplayer: Use This toolkit to debug and use sound. Mplayer xxx.wav, which plays audio files and displays the devices used for the current audio. Of course, you can also specify OSS or ALSA for playing, for example, mplayer-ao ALSA xxx.wav, and ALSA for playing.

Fdisk: displays the mounting and allocation information of a disk, such as sudo fdisk-L. It displays the mount point and purpose. For an IDE hard disk, the device names are/dev/hda,/dev/HDB,/dev/HDC,/dev/HDD, etc. For a SCSI hard disk, the device names are/dev/SDA and/dev/SDB in sequence.

Dmesg: prints kernel information. Some print statements are output to the kernel rather than the terminal.

Lsof: displays all processes that open the file. For example, lsof abc.txt displays the process of opening the abc.txt file.
=============== Network operation commands ==================================== ======================

Service Network restart: After the network service is configured, restart.

IP: integrates the ifconfig and route commands.

Ping: Same as XP. If you want it to stop, use Ctrl + C.

Netstat: The netstat command displays network connection, route table, and network interface information, allowing you to know which network connections are currently in operation.

TELNET: Start the terminal job and log on to the remote host.

Rlogin: remote login, which enables tasks in the terminal stage and logs on to the remote host.

FTP: log on to the FTP server.

Route: displays the current system route table information.

FINGER: displays information about a user in the system, such as the user name, main directory, stagnation time, Logon Time, and logon shell.

Mail: email information.

W3m: Enter the text browser on the terminal.

=============== System security commands ==================================== ======================

Passwd: change the password.

Su: the role is to change the identity of another user. Except for Super Users, you need to enter the user's password.

Umask: determines the default file creation mode. This command is actually the opposite of the CHMOD command. For example, umask 777.

Sudo: a tool that allows the system administrator to allow common users to execute some or all of the root commands, such as halt, reboot, and Su. This not only reduces the login and management time of the root user, but also improves the security.

Chmod: Change the File Permission. For example, set the CC permission to 777 for chmod 777 CC. The first is the file owner permission, the second is the group permission, and the third is the permission of others. Each permission value is the sum of read permission (4) and write permission (2) and execution permission (1.

Chown: Change the owner and group associated with the file. For example, chown Jim program. c, that is, program. the user access permission of C is now applied to Jim; chown-r JOHN: build/tmp/src, and all files under the src directory are associated with user John and the group build.

=============== VI editor command ==================================== ======================

VI editor operation:
Exit: Press ESC, Shift +:, Q. Q! Force exit. After WQ is saved, it exits.
Edit: press I to enter the edit status.
Search: Press ESC to exit the editing mode. Run "/word" to search for the string to be searched, and press "N" to find the next string.
Copy: Press ESC to exit the editing mode. to copy the current row, press YY to jump the cursor to the target row. To copy multiple rows, press YY next to the number of input rows to jump to the starting row.
Paste: Copy and jump to the target position, and press p.

=============== Compression and decompression commands ================================== ========================

Tar: Decompress the command.

.Tar.gz
Decompress: Tar zxvf filename.tar.gz

Compression: Tar zcvf filename.tar.gz dirname compresses the content of dirname into a compressed file named after filename.

.Tar.bz2
Decompress: Tar jxvf filename.tar.bz2

Compression: Tar jcvf filename.tar.bz2 dirname

. Tar

Decompress: Tar xvf filename.tar

Package: Tar CVF filename.tar dirname. This command cannot perform compression.

Related Article

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.