Learn by Category Summary, also include work commonly used, do not add regularly.
I. File processing commands
Column directory Ls-al all include hidden files, lists
Ls-s-S displays all the space for each file with the-s parameter, and the-s parameter specifies the size of all occupied space.
Switch Directory CD
Creating a directory Mkdir-p recursive creation
Remove RM-RF Force Recursive delete
Copy CP # \cp-rf/home/www/*/www
The CP command adds \ , meaning that it is not allowed to run with an alias in the ~/.BASHRC, that is, the-i parameter
Renaming or moving MV
Show current directory pwd
File links ln-s Soft Links
View files cat less more head tail
Ii. File Search Command
-
locate Search the database for/var/lib/mlocate update database updatedb /etc/updatedb.conf profile
-
whereis which find command
-
file Search find-name -a logic with Find/etc-size + 20k-a -50k wildcard match exact match
-o logic or
-exec {} \; Add command to process previous query results find/etc-size +20k-a -50k-exec ls-lh {} \;
-
file string search grep -I ignores case -v Fetch anti-grep "if"/etc/profile regular expression contains matching
Three, compression and decompression command
Zip Unzip
Tar zxvf czvf Extract create file name Directory name-C Specify directory decompression
Four, shutdown restart logoff
Logout Logout is the relative operation of the landing, after landing the system, to leave the system, the user just release the Logout command directly can
The shutdown command closes all programs and restarts or shuts down according to the user's needs.
Now← shut down immediately after +5←5 minutes shutdown 10:30← shut down at 10:30
Init 0 Poweroff is also a shutdown command, it is recommended to shutdown normal shutdown.
Reboot or init 6 restart command
Five, Network command
-
-a input -s 223.100.224.112 -p tcp -m tcp --dport 3306 -j accept iptables Specify an IP to access a port
Route add-net 10.2.1.0 netmask 255.255.255.0 GW 10.2.1.253 Add static route
Add DNS echo "nameserver 202.96.64.68" >>/etc/resolv.conf
wget Http://members.3322.org/dyndns/getip Cat GetIP
Six, Disk Management
Df-h capacity Du-s Specify location check size
FSCK/DEV/HDA1 repairing/Checking the integrity of the Linux file system on the HDA1 disk
FDISK/DEV/HDB1 partition N Add d Delete w write MBR mode partition
parted print Mkpart partition name 1050 4000 Delete Partition RM 2 quit quit
MKFS partition format MKFS.EXT3/DEV/SDB1 mkfs-t EXT4/DEV/SDB2
Mount Mount/dev/sdb1/mnt/test and add to/etc/fstab
Vii. User and User group management
/ETC/PASSWD Storage user Account Wyw:x:500:500:wyw:/home/wyw:/bin/bash
Name Password User Number group number comment home directory SHELL
/etc/group Storage Group account mail:x:12:mail,postfix Group name: Group Password: Group number: User
/etc/shadow Store password for user account
/etc/gshadow Storage User group account password Group name: Group Password: Group manager: List of user names in group
Useradd User name Useradd-g boss WYW Create user specified user group useradd-d/home/xxx wyw Specify home directory
Useradd-g group-g FFF Add a primary group at the same time
Userdel User name Userdel-r wyw folder and user names deleted
Touch/etc/nolgoin prohibit all normal users from logging in
Passwd-l wyw Lock User-u unlock-d no password login
Gpasswd-a CLS boss Add satellite Group NEWGRP boss Switch User Group this time use the group password
Usermod-c wangyouweitest wyw Add comment usermod-l wywnew wyw change user name Usermod-g maket wyw users belong to group
Groupadd Group Name groupadd-g 888 Boss Specify Group name 888
Groupmod-n maket test old and new group name
GROUPMOD-G 668 maket Reorganization number
Groupdel Group Name
passwd root sets the password for root
Su Root
Su-root
/etc/profile System Environment variables
Bash_profile User Environment variables
. BASHRC User Environment variables
SU user switches the user and loads the configuration file. bashrc
Su-user switch User, load configuration file/etc/profile, load Bash_profile
Viii. Other
Mount Mount-a Auto Mount/etc/fstab
Mount Disc mkdir/mnt/cdrom mount-t iso9660/dev/sr0 (CDROM)/mnt/cdrom
mount/dev/cdrom/mnt/cdrom/
Uninstalling the Umount device name or mount point
Mount USB Ls/dev fdisk-l View USB drive device file name
Mount-t Vfat/dev/sdb1/mnt/usb
Mount Mount-a Auto Mount/etc/fstab
cat/etc/issue Uname-r
Changing the language environment/etc/sysconfig/i18n
Toggle Boot Level /etc/inittab
Run the program in the background &, BG command
Program FG command running in foreground
If the user currently has a program running in the background, you can enter the FG command to move it from the background to the foreground to run
Last view final logged in information/var/log/wtmp file data, Lastlog view login log for all users
W Who user login view
This article is from the MJ Tech blog blog, so be sure to keep this source http://024mj.blog.51cto.com/10252785/1662399
Linux Common Commands Summary notes