Linux Common Command Daquan

Source: Internet
Author: User
Tags bz2 gpg rar

System Information The processor architecture of the Arch Display Machine (1) UNAME-M display the processor architecture of the Machine (2) uname-r display the kernel version dmidecode-q display hardware system parts-(SMBIOS/DMI) hdparm-i/dev/ HDA lists the architecture characteristics of a disk HDPARM-TT/DEV/SDA perform a test read on disk

System Information
The processor architecture of the Arch Display machine (1)
UNAME-M Display the processor architecture of the machine (2)
Uname-r displaying the kernel version in use
DMIDECODE-Q Display hardware system components-(SMBIOS/DMI)
Hdparm-i/DEV/HDA lists the architecture characteristics of a disk
HDPARM-TT/DEV/SDA performing a test read operation on the disk
Cat/proc/cpuinfo displaying information for CPU info
Cat/proc/interrupts Display Interrupt
Cat/proc/meminfo Verifying memory usage
Cat/proc/swaps shows which swap is used
Cat/proc/version version of the kernel is displayed
Cat/proc/net/dev Display network adapter and statistics
Cat/proc/mounts displaying the loaded file system
Lspci-tv List of PCI devices
LSUSB-TV Display USB Device
Date Displays the system date
Cal 2007 Displays the 2007 calendar table
Date 041217002007.00 sets the day and time of day-the year of the month. seconds
Clock-w saving time changes to the BIOS



Shutdown (System shutdown, restart, and logout)
SHUTDOWN-H now shut down system (1)
Init 0 Shutdown System (2)
Telinit 0 Shutdown System (3)
Shutdown-h Hours:minutes & Shutdown system at scheduled times
Shutdown-c Cancel the system at a predetermined time
Shutdown-r now restart (1)
Reboot restart (2)
Logout logoff



Files and directories
Cd/home Enter '/home ' directory '
Cd.. Return to the top level directory
Cd.. /.. Return to the top level two directory
CD into the personal home directory
CD ~user1 into the personal home directory
CD-Return to the last directory
PWD Display work path
ls to view the files in the directory
Ls-f viewing files in a directory
Ls-l displaying details of files and directories
Ls-a Show hidden files
LS *[0-9]* displays filenames and directory names that contain numbers
Tree displays files and directories starting with the root directory (1)
Lstree displaying files and directories starting with the root directory tree (2)
mkdir dir1 Create a directory called ' Dir1 '
mkdir dir1 DIR2 Create two directories at a time
Mkdir-p/tmp/dir1/dir2 Create a directory tree
Rm-f file1 Delete a file called ' File1 '
RmDir dir1 Delete a directory called ' Dir1 '
RM-RF Dir1 Delete a directory called ' Dir1 ' and delete its contents at the same time
RM-RF dir1 DIR2 Delete two directories and their contents at the same time
MV Dir1 New_dir Renaming/Moving a directory
CP file1 file2 Copy a file
CP dir/*. Copy all files under 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
Ln-s file1 lnk1 Create a soft link to a file or directory
ln file1 lnk1 Create a physical link to a file or directory
Touch-t 0712250000 File1 Modify the timestamp of a file or directory-(YYMMDDHHMM)
File File1 outputs the MIME type of the file as text
Iconv-l List of known encodings
Iconv-f fromencoding-t toencoding inputfile > OutputFile creates a new from the given input file by assuming it is en Coded in fromencoding and converting it to toencoding.
Find. -maxdepth 1-name *.jpg-print-exec Convert "{}"-resize 80x60 "thumbs/{}" \; Batch resize files in the current directory and send them to a thumbnails directory (requires convert from Imagemagick)



File Search
Find/-name file1 from '/' to the root file system to search for files and directories
Find/-user User1 search for files and directories belonging to user ' User1 '
Find/home/user1-name \*.bin in directory '/home/user1 ' search for files with '. Bin '
Find/usr/bin-type f-atime +100 Search execution files that have not been used in the last 100 days
Find/usr/bin-type f-mtime-10 search for files 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 drives, Czech disks, etc.
Locate \*.ps looking for files ending with '. ps '-run the ' updatedb ' command first
Whereis Halt shows the location of a binary file, source code, or man
Which halt displays the full path of a binary file or executable file



mount a file system
MOUNT/DEV/HDA2/MNT/HDA2 mount a disk called hda2-ok directory '/mnt/hda2 ' already exists
UMOUNT/DEV/HDA2 unload a disk called Hda2-first from Mount point '/mnt/hda2 ' exit
Fuser-km/mnt/hda2 force unload when the device is busy
Umount-n/mnt/hda2 run unload operation without writing/etc/mtab file-useful when file is read-only or when 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 to mount a Windows FAT32 file system
Mount/dev/sda1/mnt/usbdisk mount a USB drive or flash device
Mount-t Smbfs-o Username=user,password=pass//winclient/share/mnt/share to mount a Windows network share



Disk space
DF-H displays a list of the partitions that are already mounted
LS-LSR |more arranging files and directories in size
Du-sh dir1 estimate directory ' Dir1 ' already used disk space '
Du-sk * | SORT-RN display the size of files and directories in terms of capacity size
Rpm-q-a--qf '%10{size}t%{name}n ' | SORT-K1,1N the space used by the installed RPM package, based on size (Fedora, Redhat class System)
Dpkg-query-w-f= ' ${installed-size;10}t${package}n ' | SORT-K1,1N Displays the space used by the installed Deb package based on size (Ubuntu, Debian System)


Users and Groups
Groupadd group_name Create a new user group
Groupdel group_name Delete a user group
Groupmod-n new_group_name old_group_name Renaming 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 "User FTP"-G system-d/ftp/user1-s/bin/nologin user1 to modify users ' properties
passwd changing passwords
passwd User1 Modify a user's password (root only allowed)
Chage-e 2005-12-31 user1 setting the expiration period for user passwords
Pwck checking the file format and syntax corrections of '/etc/passwd ' and the presence of the user
GRPCK checking the file format and syntax corrections of '/etc/passwd ' and the presence of groups
Newgrp group_name Log in to a new group to change the preset group of newly created files


Permissions for files-use "+" to set permissions, use "-" to cancel
LS-LH Display Permissions
ls/tmp | Pr-t5-w$columns the terminal into 5 column display
chmod ugo+rwx Directory1 Set directory owner (U), Group (g), and others (O) to read (R), write (w), and execute (x) permissions
chmod go-rwx directory1 Delete Group (g) Read and write execution permissions to the directory with others (O)
Chown user1 File1 Change the Owner property of a file
Chown-r User1 Directory1 Change the owner property of a directory and change the properties of all files in the directory at the same time
CHGRP group1 file1 Changing a group of files
Chown user1:group1 File1 Changing the owner and group properties 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 for a binary file
chmod G+s/home/public sets the Sgid bit of a directory-similar to suid, but this is a directory-specific
chmod g-s/home/public Disable SGID bit of a directory
chmod O+t/home/public Set the STIKY bit of a file-allow only legitimate owners to delete files
chmod o-t/home/public Disable STIKY bit of a directory


Special properties of the file-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 A file system backup, the DUMP program ignores this file
Chattr +i File1 is set to an immutable file and cannot be deleted, modified, renamed, or linked
Chattr +s File1 allows a file to be safely deleted
Chattr +s File1 Once the application writes to this file, the system immediately writes the result of the modification to the disk
Chattr +u File1 If the file is deleted, the system will allow you to recover the deleted file later.
Lsattr Displaying special properties


Packaging and compressing files
BUNZIP2 file1.bz2 Extract a file called ' file1.bz2 '
bzip2 file1 compress 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 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 Package
Unrar x File1.rar decompression rar Package
TAR-CVF Archive.tar File1 Create a non-compressed tarball
TAR-CVF Archive.tar file1 file2 dir1 Create a file containing ' file1 ', ' file2 ' and ' Dir1 '
TAR-TF Archive.tar Display 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 extract a compressed package in BZIP2 format
TAR-CVFZ archive.tar.gz Dir1 Create a zipped package in gzip format
TAR-XVFZ archive.tar.gz Unzip a compressed package in gzip format
Zip file1.zip file1 Create a zip-format compression Package
Zip-r file1.zip file1 file2 Dir1 compresses several files and directories into a zip-format package at the same time
Unzip File1.zip unzip a zip-format tarball


RPM Packages-(Fedora, Redhat and similar systems)
RPM-IVH package.rpm Installing an RPM package
RPM-IVH--nodeeps package.rpm Install an RPM package and ignore dependency warnings
Rpm-u package.rpm Update a RPM package without changing its configuration file
Rpm-f package.rpm update one to determine which RPM package is installed
Rpm-e package_name.rpm Delete an RPM package
RPM-QA display all installed RPM packages in the system
Rpm-qa | grep httpd shows all RPM packages with the words "httpd" in their names
Rpm-qi Package_name get special information for an installed package
RPM-QG "System environment/daemons" shows the RPM package for a component
RPM-QL Package_name displays a list of files provided by an already installed RPM package
RPM-QC Package_name Displays a list of configuration files provided by an already installed RPM package
Rpm-q package_name--whatrequires shows a list of dependencies that exist with a RPM package
Rpm-q package_name--whatprovides shows the volume of a RPM package
Rpm-q package_name--scripts Show scripts executed during installation/removal L
Rpm-q package_name--changelog shows the revision history of a RPM package
rpm-qf/etc/httpd/conf/httpd.conf confirm which RPM package is provided for the given file
RPM-QP package.rpm-l displays a list of files provided by a RPM package that has not been installed
RPM--import/media/cdrom/rpm-gpg-key Import Public key digital certificate
RPM--checksig package.rpm confirming the integrity of a RPM package
RPM-QA Gpg-pubkey confirm the integrity of all RPM packages that have been installed
Rpm-v package_name Check file size, license, type, owner, group, MD5 check, and last modified time
Rpm-va Check all installed RPM packages in the system-use with care
RPM-VP package.rpm confirm that an RPM package is not installed
Rpm2cpio package.rpm | Cpio--extract--make-directories *bin* Run executable from an RPM package
rpm-ivh/usr/src/redhat/rpms/' arch '/package.rpm install a built-in package from a RPM source
Rpmbuild--rebuild package_name.src.rpm Build a RPM package from one RPM source


YUM Package Upgrade-(Fedora, Redhat and similar systems)
Yum install package_name download and install a RPM package
Yum Localinstall package_name.rpm will install a RPM package and use your own software repository to resolve all dependencies for you
Yum Update package_name.rpm updates all installed RPM packages in the current system
Yum Update package_name updates a RPM package
Yum Remove package_name Delete an RPM package
Yum list lists all packages installed in the current system
Yum search package_name searching for packages in RPM repositories
Yum Clean Packages cleanup rpm cache to delete downloaded packages
Yum Clean headers Delete all header files
Yum Clean all deletes all cached packages and header files


DEB packages (Debian, Ubuntu and similar systems)
Dpkg-i package.deb Install/update a deb Package
Dpkg-r package_name Remove a deb package from the system
DPKG-L display all installed Deb packages in the system
Dpkg-l | grep httpd Displays all the Deb packages with the words "httpd" in their names
Dpkg-s Package_name get information on a special package already installed in the system
Dpkg-l Package_name displays a list of files provided by a Deb package that is already installed in the system
Dpkg--contents Package.deb shows a list of files provided by a package that has not yet been installed
Dpkg-s/bin/ping confirm which Deb package the given file is provided by


APT software tools (Debian, Ubuntu and similar systems)
Apt-get install package_name Installing/updating a deb package
Apt-cdrom install package_name Installing/updating a Deb package from CD
Apt-get update packages in the upgrade list
Apt-get Upgrade upgrade all installed software
Apt-get Remove Package_name A deb package from the system
Apt-get Check to verify that the software repositories that are dependent are correct
Apt-get clean the cache from the downloaded package
Apt-cache Search Searched-package Returns the package name that contains the string you want to search

Linux Common Command Daquan

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.