Common commands in Linux

Source: Internet
Author: User

=============== 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.

Shutdown: shut down the linux system. parameters can be added later, such as shut down now.

Reboot: restart linux.

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 indicate the linux root directory, and 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 view the LINUX kernel version, use cat/proc/version; view the memory information, use cat/proc/meminfo; view the 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 modules. Many functions of Linux are loaded into the kernel only when necessary.

Rmmod: uninstall the module.

Rpm: similar to "Add/delete programs" in Windows, it is widely used to install and delete software in Linux. 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.

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.