1. Commands for 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
2. Commands to view 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
3. File and Directory operation commands
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
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 File1 Create a file
4. File Search command
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
Locate \*.ps looking for files ending with '. ps '-run the ' updatedb ' command first
Whereis file Displays the location of a binary, source, or man
Which file displays the full path of a binary or executable file
5. View the contents of a file
Cat File1 Viewing the contents of a file starting from the first byte
TAC File1 To reverse view the contents of a file from the last line
More File1 View the contents of a long file
Less file1 is similar to the ' more ' command, but it allows a reverse operation in the same way as a forward operation in a file
Head-2 File1 View the first two lines of a file
Tail-2 File1 View the last two lines of a file 5. Mount command
MOUNT/DEV/HDA2/MNT/HDA2 mount a disk called hda2 (note: OK directory '/mnt/hda2 ' already exists)
Umount/dev/hda2 unloading 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 an unload 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 disc
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
6. Commands for disk space operations
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
7. User and group related commands
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 ' at the same time delete the home directory)
passwd User1 Modify a user's password (root only allowed)
Chage-e 2005-12-31 user1 setting the expiration period for user passwords
LS-LH Display Permissions
chmod 777 Directory1 Set directory owner (U), Group (g), and others (O) to read (R), write (w), and execute (x) permissions
chmod 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 for use1.
Chown-r User1 Directory1 Change the owner property of a directory and change the properties of all files in the directory to use1 all
CHGRP group1 file1 Changes the file to a group of group1
Chown user1:group1 File1 Change the owner and group properties of a file, the owning group is group1 and the user is use1.
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
8. The command to package and decompress 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 packaging ' file1 ', ' file2 ' and directory ' Dir1 '
rar x file1.rar rar Package
Unrar x File1.rar extract rar Package
TAR-CVF Archive.tar File1 Create a non-compressed tar package
TAR-CVF Archive.tar file1 file2 dir1 Create a package containing ' file1 ', ' file2 ' 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 to the/tmp directory (-c is the specified 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
9. Commands for RPM packages
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-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
10.YUM Package Upgrade
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
CentOS Basic Command Daquan