Common Linux terminal commands

Source: Internet
Author: User
Tags bz2 create directory rpmbuild

First, the file directory class
1. Create directory: mkdir directory name
2. Delete Empty directory: RmDir directory name
3. Unconditional deletion of subdirectories: RM-RF directory Name
4. Change the current directory: CD directory name (go to User home directory: cd ~; go to the top level directory: CD-)
5. View your directory: PWD
6. View the current directory size: Du
7. Display directory file list: Ls-l (-A: Add display hidden directory)
Where: Blue: directory; green: executable file; red: compressed file; light blue: Link file; Gray: other files; red background white: Wrong link file
8. Browse Files: More file names. txt;less filename. txt
9. Copy files: CP source file Target file (-r: Include directory)
10. Find File: (1) Find (2) Locate command name
11. Link: (1) Establish hard link: ln source file Link file (-d: Create directory link), (2) Establish symbolic Link: ln-s source file Link file

Two. Drive Mount class
1. Check the drive usage: df-t-H
2. Check the disk partition: Fdisk-l
3. Mount the soft hard light zone: mount-t/dev/fdx|hdax/mnt/directory Name
Including:: Modos--fat16;vfat--fat32;ntfs--ntfs; optical drive--iso9660
Support Chinese name: Mount-o iocharset=x/dev/hdax/mnt/directory Name (where: x=cp936 or
Mount Optical drive: mount-t auto/dev/cdrom/mnt/cdrom
Mount ISO file: mount-t iso9660-o loop Xxx.iso/path
4. Release mount: umount/mnt/directory Name
Remove all mounts: umount-a
5. Establish file system: Mkfs-t/dev/hdxx. Among them: Ftype:ext2, ext3, swap, etc.

Three. Program Installation class
1.RPM Package Installation: (1) Install RPM-IVH somesoft.rpm
(2) Anti-installation rpm-e somefost.rpm
(3) Query rpm-q somefost or Rpm-qpi somefost.rpm (where: P not installed; I contains information)
(4) query after installation location: RPM-QL somefost.rpm
(5) Upgrade installation: RPM-UVH somesoft.rpm
(6) Forced installation: Rpm-ivh--nodeps somesoft.rpm or RPM-IVH--nodeps--force somesoft.rpm

2. Source Code Package Installation:
Read the Readme
Basic usage (1) configuration: Unzip the directory./configure
(2) Compile: Unzip directory make
(3) Install: Unzip directory make install
Installation of 3.src.rpm
You need to use the Rpmbuild command plus the--rebuild parameter. such as Rpmbuild--rebuild ***.src.rpm. and find it under the/usr/src/.
3.FC3 ISO program installation: System-config-packages--isodir=iso Directory
RH under ISO program installation: Redhat-config-packages--isodir=iso Directory

Four. Compression Decompression class
1.tar.gz class: (1) Extract: Tar-xvzf file. tar.gz; (2) tar.gz to tar:gzip-d file. tar.gz (2) Compression: gzip files for compression
2.tar Uncompressed class: (1) Unpacking: TAR-XVF file. tar; (2) Packaging: TAR-CVF file. tar file list
3.zip class: (1) Extract: Unzip file. zip-d dir; (2) Compression: Zip ZipFile List of files to be compressed
4.BZ2 class: (1) Extract: Bunzip2 file. bz2 or bzip2-d file. bz2; (2) Compression: BZIP2 files to be compressed
5.z class: (1) Extract: Uncompress file. Z; (2) Compression: Compress file

Five. Process Control class
1. List the current process Id:ps-auxw
2. Terminating the process: (1) terminating a single process: Kill process ID Number
(2) Terminate the program All processes: Killall program name
(3) Termination of X-window program: Xkill
3. View Resource Usage: (1) Top (2) Free (3) DMESG
4. View environment variable values: ENV
5. Restart: (1) Reboot (2) Ctrl Alt Del (3) Init 6
6. Shutdown: (1) Shutdown-h now (2) halt (3) Init 0
7. Switch Desktop: Switchdesk gnome| Kde| ...

Six. Program Run class

1. Query command: Whereis command name
2. Background Run X-window Program: Program Name &
3. Forced exit X-window Program: Ctrl Alt Backspace
4. View Help:
(1) Concise help: command name--help | Less
(2) More help: Man command name
(3) Info command name
(4) Help command name
5. View the system path: Echo $PATH
6. View the current shell stack: Echo $SHLVL
7.<: input/output redirection; |: Pipeline left input is pipe right input

Seven. User account class

1. Add user account: (1) User name: AddUser user account name
(2) Set Password: passwd user account name
2. Delete user account: Userdel user account name
3. Add user group: Groupadd user Group name
4. Delete user group: Groupdel user Group name
5. Temporarily terminate user account: Passwd-l user account name
6. Restore the terminated account: Passwd-u user account name
7. Permission settings

(1) Chmod-a|u|g|o |-|=r|w|x File/directory Name
Where: a--all users, u--(user), g--User Group (group), o--other users
--Add permissions,---delete permissions; =--set permissions
File: r--read-only permission (read), w--Write permission (write), x--Execute permission (execute)
Directory: r--allows files and subdirectories under the column directory; w--allows you to generate and delete files under directories; x--allow access to the directory
(2) chmod xxx File/directory name
of which: execute=1;write=2;read=4
X value: 0--does not have any permissions (common); 2--can only be written (uncommon); 3--can only be written and executed (uncommon); 4--read-only (common); 5--read-Only and execute (common); 6--reads and writes (common); Write and Execute

Eight. VI Editing class
1. Enter after the command mode: (1) Insert I; (2) Open 0; (3) Modify C; (4) Replace R; (5) Replace S
2. Enter full screen editing mode after (1).
3. Command mode--edit mode (a/i), edit mode--command mode (ESC), Command mode--and last line mode (:).
4.:w/w NewFile Save
5.:q/q! Exit Iv;:wq Save exit

Nine. Network services
1. Display Network interface parameters: Ifconfig
2. Display System mail: Mail
3. Start/Stop Web service: Httpd-k start|stop|restart
4. View network Status: (1) Online Status: Ping xxx.xxx.xxx.xxx;
(2) Display network status: Netstat, wherein: options:-a== all sockets;-l== contain network equipment;-n== digital IP;
-o== other information;-r== routing table;-t== only column TCP sockets;-u== only column UDP sockets;-w== column raw sockets;
-x== only UNIX Domain sockets

Common Linux terminal commands

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.