Classification of common linux Commands

Source: Internet
Author: User
Tags unzip rar
Common linux Commands. shut down, restart, and log out of www.2cto. comshutdown-hnow shut down the system (1) shutdown-hhours: minutes & amp; shut down the system shutdown-c close the system shutdown at the scheduled time... common linux Commands. shutdown, restart, and logout of the system www.2cto.com shutdown-h now shut down the system (1) shutdown-h hours: minutes & shut down system shutdown by scheduled time-c cancel shut down system shutdown by scheduled time-r now restart (1) init 0 shut down system (2) telinit 0 shut down system (3) www.2cto.com reboot restart (2) Log Out 2. file and directory 2.1 change the current directory (change directory) cd/home to '/h Ome 'directory 'CD... back to the upper-level directory cd ~ User1 go to my home directory cd-return to the last Directory pwd display working path 2.2 view the files in the Directory (list files) ls view files in the directory ls-F View files in the directory ls-l show files and directory details ls-a show hidden files ls * [0-9] * show contains numbers file name and directory name tree display the tree structure of the file and directory starting from the root directory (1) lstree displays the tree structure of files and directories starting from the root directory (2) 2.3 Create directory file mkdir dir1 create a directory named 'dir1' 'mkdir dir1 dir2 create two directories at the same time mkdir-p/tmp/dir1/dir2 create a directory tree 2.4 delete directory file rm -f file1: delete a file named 'file1' 'rmdir dir1 delete a directory named 'dir1' 'rm-rf dir1 delete a directory named 'dir1' and delete its contents at the same time rm-rf dir1 dir2 simultaneously deletes two directories and their contents. 2.5 copy and move the file mv dir1 new_dir rename/move a directory cp file1 file2 copy a file cp dir /*. copy all files in a 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 search find/-name file1 start from '/' to enter the root file system Search file and directory find/-user user1 search for files and directories belonging to user 'user1' find/home/user1 -name \*. bin search for the directory '/home/user1' '. find/usr/bin-type f-atime + 100 find/usr/bin-type f-atime + 100 find/usr/bin-type f-mtime- 10. search for the find/-name \ * file created or modified in the last 10 days \*. rpm-exec chmod 755 '{}' \; search '. the file ending with rpm and its permission to find/-xdev-name \*. rpm Search '. the files at the end of rpm, ignoring the drive, disk, and other removable devices locate \*. ps to find '. ps-run the 'updatedb' command whereis halt to display the location of a binary file, source code, or man. which halt shows the complete path of a binary file or executable file. 4. mounting a file system 4.1 in a windows operating system, mounting usually refers to assigning a drive letter to a disk partition (including a virtualized disk partition); 4.2 in a linux operating system, mounting means to mount a device (usually a storage device) to an existing directory. we want to access files in the storage device, the partition where the file is located must be mounted to an existing directory, then, access the storage device mount/dev/hda2/mnt/hda2 and mount a disk named hda2 by accessing this directory.-confirm that the directory '/mnt/hda2' already exists. umount/dev/hda2 detach a disk named hda2-first exit fuser-km/mnt/hda2 from the Mount point and forcibly detach umount-n/mnt/hda2 when the device is busy operation without writing the/etc/mtab file-when the file is read-only or when the disk is full, it is very useful to mount/dev/fd0/mnt/floppy to 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. mount an iso/mnt/cdrom file or an ISO image file mount-t vfat/dev/hda5/mnt/hda5 mount a Windows FAT32 file system mount/dev/sda1/mnt/USB disk mount-t smbfs-o username = user, password = pass // WinClient/share/mnt/share mount a windows network share. user and group groupadd 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 useradd user1 belonging to the "admin" user group create a new user userdel-r user1 delete a user ('-R' exclude the main directory) usermod-c "User FTP"-g system-d/ftp/user1-s/bin/nologin user1 modify User attributes passwd change password passwd user1 change the password of a User (only allow root execution) chage-E 2005-12-31 user1 set the expiration time of the user password pwck check '/etc/passwd' file format and syntax correction, and the existing user grpck check'/etc/passwd 'file format and syntax correction and the existing group newgrp group_name log into a new group to change the default group of the newly created File 6. use "+" to set permissions for files, use "-" to cancel the ls-lh display permission ls/tmp | pr-T5-W $ COLUMNS to divide the terminal into 5 COLUMNS and display the owner of the chmod ugo + rwx directory1 setting Directory (u) group (g) and others (o) delete group (g) with the chmod go-rwx directory1 permission for Read (r), write (w), and execute (x) with others (o) read and write permissions on the directory chown user1 file1 change the owner attribute of a file chown-R user1 directory1 change the attributes of all the files in a directory and change the attributes of chgrp group1 file1 change file group chown user1: group1 file1 changes the owner and group attributes of a file. find/-perm-u + s lists all files in the system that use SUID control. chmod u + s/bin/file1 sets a binary value. SUID bit of the file-the user who runs the file is also granted the same permission as the owner chmod u-s/bin/file1 to disable the SUID bit chmod g + s/home/of a binary file/ public sets the SGID bit of a directory-similar to SUID, however, this is to disable the SGID chmod o + t/home/public of a directory for chmod g-s/home/public-to set the STIKY bit of a file-only allow the legal owner to delete the file. chmod o-t/home/public disable the STIKY bit of a directory 7. special properties of the special properties File-use "+" to set permissions, use "-" to cancel chattr + a file1 and only allow reading and writing files in append mode. chattr + c file1 allows this file to be automatically compressed by the kernel/decompress chattr + d file1 for file system backup., the dump program will ignore this file chattr + I file1 and set it to an immutable file, you cannot delete, modify, rename, or link ch0attr + s file1 to allow a file to be safely deleted. Once the application performs write operations on the file, the system immediately writes the modification result to the disk chattr + u file1. if the file is deleted, the system will allow you to restore the deleted file in the future. package and compress bunzip2 file1.bz2 unzip a file called 'file1.bz2' bzip2 file1 compress a file named 'file1' gunzip file1.gz decompress a file named 'file1.gz 'gzip file1 compress a file named 'file1' file gzip-9 file1 maximum compression rar a file1.rar test_file create a package named 'file1.rar 'rar a file1.rar file1 file2 dir1 simultaneously compress 'file1 ', 'file2' and directory 'dir1' rar x file1.rar unzip rar package unrar x file1.rar unzip rar package tar-cvf archive.tar file1 create a non-compressed tarball tar-cvf archive.tar file1 file2 dir1 create including 'file1 ', the file tar-tf archive.tar of 'file2' and 'dir1' shows the content tar-xvf archive.tar in a package. release a package tar-xvf archive.tar-C/tmp to release the package to/tmp. under the tar-cvfj unzip dir1 Directory, create a bzip2 compressed package tar-xvfj unzip a bzip2 compressed package tar-cvfz archive.tar.gz dir1 and create a gzip compressed package tar-xvfz archive.tar.gz create a zip-format zip package zip file1.zip file1 create a zip-format zip package zip-r file1.zip file1 file2 dir1 compress several files and directories into a zip-format zip package unzip file1.zip decompress a zip package
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.