Linux Common Commands Summary notes

Source: Internet
Author: User

Learn by Category Summary, also include work commonly used, do not add regularly.

I. File processing commands

  1. 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.

  2. Switch Directory CD

  3. Creating a directory Mkdir-p recursive creation

  4. Remove RM-RF Force Recursive delete

  5. 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

  6. Renaming or moving MV

  7. Show current directory pwd

  8. File links ln-s Soft Links

  9. View files cat less more head tail

Ii. File Search Command

    1. locate   Search the database for/var/lib/mlocate update database updatedb /etc/updatedb.conf profile

    2. whereis which find command

    3. 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 {} \;

    4. 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

    1. 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

    2. 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.

    3. Reboot or init 6 restart command

Five, Network command

  1. -a input -s 223.100.224.112 -p tcp -m tcp --dport 3306 -j  accept    iptables Specify an IP to access a port

  2. Route add-net 10.2.1.0 netmask 255.255.255.0 GW 10.2.1.253 Add static route

  3. 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

  1. 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

  2. Mount USB Ls/dev fdisk-l View USB drive device file name

    Mount-t Vfat/dev/sdb1/mnt/usb

  3. Mount Mount-a Auto Mount/etc/fstab

  4. cat/etc/issue Uname-r

  5. Changing the language environment/etc/sysconfig/i18n

  6. Toggle Boot Level /etc/inittab

  7. 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

  8. Last view final logged in information/var/log/wtmp file data, Lastlog view login log for all users

  9. 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

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.