Linux Common command sorting and sorting __linux

Source: Internet
Author: User

Turn from: http://blog.csdn.net/orclight/article/details/8645545

1. Shutdown, restart, and logoff of the systemShutdown-h now Shutdown system (1)
Shutdown-h hours:minutes & Shut down system at scheduled time
Shutdown-c Cancel system shutdown at scheduled time
Shutdown-r now reboot (1)
Init 0 Shutdown System (2)
Telinit 0 Shutdown System (3)

Reboot reboot (2)
Logout logoff
2. Documents and Directories 2.1 Transform current directory (change directory)Cd/home into '/home ' directory '
Cd.. Return to the previous level of the directory
Cd.. /.. Back to Level two directory
CD goes to personal home directory
CD ~user1 into a personal home directory
CD-Back to the last directory
PWD Display work path
2.2 View the files in the directory (list files)LS View the files in the directory
Ls-f view files in a directory
Ls-l display details of files and directories
Ls-a Show hidden files
LS *[0-9]* Displays the file name and directory name that contains the number
Tree shows the roots of the file and directory by the root directory (1)
Lstree display file and directory tree structure starting from root directory (2)
2.3 Creating a directorymkdir dir1 Create a directory called ' Dir1 '
mkdir dir1 DIR2 Create two directories at the same time
Mkdir-p/tmp/dir1/dir2 Create a directory tree
2.4 Deleting directory filesRm-f file1 Delete a file called ' File1 '
RmDir dir1 Delete a directory called ' Dir1 '
RM-RF Dir1 Deletes a directory called ' Dir1 ' and deletes its contents at the same time

RM-RF dir1 DIR2 Delete two directories and their contents at the same time


2.5 New files & View Files

Touch test.txt A new file called text.txt (suffix txt can not be written)

More Test.txt View file content with (cannot edit)

VI test.txt Edit the file, the editor has a lot of VI command2.6 Copying and moving filesMV Dir1 new_dir rename/move a directory
CP file1 file2 Copy a file
CP dir/*. Copy all files in one directory to the current working directory
Cp-a/tmp/dir1. Copy a directory to the current working directory
Cp-a dir1 dir2 Copy a directory
3. File SearchFind/-name file1 from '/' into root file system search files and directories
Find/-user User1 search for files and directories belonging to the user ' User1 '
Find/home/user1-name \*.bin searches the directory '/Home/user1 ' for files with '. Bin ' End
Find/usr/bin-type f-atime +100 searches for executable files that have not been used in the last 100 days
Find/usr/bin-type f-mtime-10 search for files that were created or modified within 10 days
Find/-name \*.rpm-exec chmod 755 ' {} ' \; Search for files ending with '. RPM ' and define their permissions
Find/-xdev-name \*.rpm search for files ending with '. RPM ', ignoring removable devices such as optical drive, Czech disk, etc.
Locate \*.ps looking for files ending with '. ps '-run the ' updatedb ' command first
Whereis Halt Displays the location of a binary file, source code, or man
Which halt displays the full path of a binary file or executable file
4. Mount a file system4.1 In the Windows operating system, mounts usually refer to a disk partition (including the virtual partition of the disk) to allocate a letter;
4.2 In a Linux operating system, a mount is a device (usually a storage device) that is hooked up to an existing directory
To access the files on the storage device, you must mount the partition where the file resides on an existing directory and access the storage device by accessing the directory

MOUNT/DEV/HDA2/MNT/HDA2 mount a disk called Hda2-determine directory '/mnt/hda2 ' already exists
Umount/dev/hda2 Uninstall a disk called Hda2-first from Mount point '/mnt/hda2 ' exit
Fuser-km/mnt/hda2 Force Uninstall when the device is busy
Umount-n/mnt/hda2 Run the uninstall operation without writing to the/etc/mtab file-useful when the file is read-only or when the disk is full
Mount/dev/fd0/mnt/floppy mount a floppy disk
Mount/dev/cdrom/mnt/cdrom mount a CDROM or dvdrom
Mount/dev/hdc/mnt/cdrecorder mount a CDRW or dvdrom
Mount/dev/hdb/mnt/cdrecorder mount a CDRW or dvdrom
Mount-o Loop File.iso/mnt/cdrom mount a file or ISO image file
Mount-t vfat/dev/hda5/mnt/hda5 mount a Windows FAT32 file system
Mount/dev/sda1/mnt/usbdisk mount a USB Czech disk or flash device
Mount-t Smbfs-o username=user,password=pass//winclient/share/mnt/share mount a Windows network share
5. Users and GroupsGroupadd group_name Create a new user group
Groupdel group_name Delete a user group
Groupmod-n new_group_name old_group_name Rename a user group
Useradd-c "Name Surname"-G admin-d/home/user1-s/bin/bash user1 create a user who belongs to the "admin" user group
Useradd User1 create a new user
Userdel-r User1 Delete a user (' R ' Exclude home directory)
Usermod-c the "User FTP"-G system-d/ftp/user1-s/bin/nologin user1 Modify user Properties
passwd Modify Password
passwd user1 modifies a user's password (only root execution is allowed)
Chage-e 2005-12-31 User1 set expiration period for user password
PWCK check the '/etc/passwd ' file format and syntax corrections as well as the existence of the user
GRPCK check the '/etc/passwd ' file format and syntax corrections as well as the existing group
NEWGRP group_name Log into a new group to change the default group of newly created files
6. Permissions on FilesUse ' + ' to set permissions, use '-' to cancel
LS-LH Display Permissions
ls/tmp | Pr-t5-w$columns divides the terminal into 5 columns to display
chmod ugo+rwx Directory1 Sets the owner (U), Group (g), and others (O) of the directory to read (R), write (w), and execute (x) permissions
chmod go-rwx directory1 Delete Group (g) Read and write permissions to the directory with others (O)
Chown user1 file1 Change the owner attribute of a file
Chown-r User1 Directory1 Changes the owner attribute of a directory and simultaneously changes the attributes of all files under the modified directory
CHGRP group1 file1 Change the file group
Chown user1:group1 File1 Change the owner and group attributes of a file
Find/-perm-u+s lists all files in a system that use SUID control
chmod U+s/bin/file1 sets the SUID bit of a binary file-the user who runs the file is also given the same permissions as the owner
chmod u-s/bin/file1 Disables the suid bit of a binary file
chmod G+s/home/public Set the Sgid bit of a directory-similar to suid, but this is for directory
chmod g-s/home/public Disables the SGID bit of a directory
chmod O+t/home/public Set the Stiky bit of a file-allows only legitimate owners to delete files
chmod o-t/home/public Disables the stiky bit of a directory
7. Special properties of the fileSpecial properties for Files-use "+" to set permissions, use "-" to cancel
Chattr +a File1 only allowed to read and write files in append mode
Chattr +c File1 allows this file to be automatically compressed/decompressed by the kernel
Chattr +d file1 The DUMP program ignores this file when making a file system backup
Chattr +i File1 is set to immutable files and cannot be deleted, modified, renamed, or linked
Ch0attr +s File1 allows a file to be safely deleted
Chattr +s File1 Once the application writes to the file, the system immediately writes the resulting changes to the disk
Chattr +u File1 If the file is deleted, the system will allow you to recover the deleted file later.
Lsattr Display Special Properties
8. Packaging and CompressionBUNZIP2 file1.bz2 Extract a file called ' file1.bz2 '
bzip2 File1 compresses a file called ' File1 '
Gunzip file1.gz Extract a file called ' file1.gz '
gzip File1 compress a file called ' File1 '
gzip-9 file1 Maximum Compression
RAR a file1.rar test_file to create a package called ' File1.rar '
RAR a file1.rar file1 file2 dir1 simultaneously compresses ' file1 ', ' file2 ' and directory ' Dir1 '
rar x file1.rar decompression rar bag
Unrar x file1.rar decompression rar bag
TAR-CVF Archive.tar file1 Create a uncompressed tarball
TAR-CVF Archive.tar file1 file2 dir1 Create an archive containing ' file1 ', ' file2 ' and ' Dir1 '
TAR-TF Archive.tar Displays the contents of a package
TAR-XVF Archive.tar Release a package
TAR-XVF ARCHIVE.TAR-C/TMP releases the compressed package into the/tmp directory
TAR-CVFJ archive.tar.bz2 Dir1 Create a compressed package in BZIP2 format
TAR-XVFJ ARCHIVE.TAR.BZ2 Unzip a compressed package in a bzip2 format
TAR-CVFZ archive.tar.gz Dir1 Create a compressed package in gzip format
TAR-XVFZ archive.tar.gz Unzip a gzip-formatted compressed package
Zip file1.zip file1 Create a zip-formatted compressed package
Zip-r file1.zip file1 file2 Dir1 compresses several files and directories simultaneously into a zip-formatted compressed package
Unzip File1.zip unzip a ZIP format compressed package

Reference links
1.linux Common Commands http://www.php100.com/html/webkaifa/Linux/2009/1106/3484.html
2.linux Command Encyclopedia http://www.php100.com/html/webkaifa/Linux/2009/1106/3485.html
3. Common command Complete http://linux.chinaitlab.com/special/linuxcom/

4.Linux Process Management Command detailed http://blog.163.com/lgh_2002/blog/static/4401752620100211113033/

5.Linux common viewing process and forced shutdown process method http://blog.csdn.net/snlying/article/details/6217965

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.