Summary of common common commands for Linux

Source: Internet
Author: User
Tags create directory unpack

Recently in learning Linux from 0, it took 10 days to get basic commands and a realistic use of operational learning points fur. Many Linux commands are summarized here for review

Directory structure:

/: root directory, usually under the sub-directory, not put files;

/dev: Stores the device files under the Linux system and accesses a device in that directory, equivalent to accessing a device;

/root: System administrator directory;

/home: The Default User directory of the system;

/lost+found: System Abnormal error is, will put some missing fragments here, this can open to see (I have not seen);

/etc: Storage System configuration file;

/lib: The directory of function libraries used by the system;

Common commands

Init 3: Graphical interface to character interface, Init 5: Character-type interface to graphical interface;

Tab: File path is not complete, command is not complete;

CTRL + C: terminates a running program;

User Management commands: permissions only for Superuser

Add user Useradd useradd SMB generates a directory with the same name as the user name in the/home/directory.

Deleting a user Userdel Userdel SMB removes the user/userdel-r SMB "-r" option that is named SMB to remove the User Directory page under the/home directory

Modify password passwd passwd SMB

Switch User su su-smb/su-root switch to Super user to enter password

Add user group Groupadd Groupadd group1

Delete user group Groupdel Groupadd group1

View Catalog ls ls/home/(note: no hidden files) ls-a/home/(Note: contains hidden files) ls-l/home/(with details similar to ll/home/)

Modify the File working directory CD Cd/home (go to home directory) CD. (Return to previous directory) CD-(recall the directory where the last action was) CD. /..

Copy the file or directory CP cp/home/test.txt/root/(copy the test.txt from the home directory to the root directory) cp-r/home/dir1/root/(copy directory)

Move or rename a file | directory MV mv/home/hello.c/home/hello1.c (renaming a file in the home directory) mv/home/hello.c/tmp/(move the file under the home directory to the TMP directory)

mv/home/dir/tmp/(The directory dir under home is clipped to TMP)

Create directory mkdir mkdir/home/mydir (create mydir directory in home directory) mkdir-p/HOME/DIR1/DIR2/DIR3 (Create multiple directories consecutively)

Delete File | directory rm rm/home/hello.c (delete file) rm-r/home/dir1 (delete directory)

Change file access rights chmod chmod who +|-|=mode/home/hello.c chmod u+x/home/hello.c Modify permissions for user users who:u file owner, G file group, o Other user, a all users

Mode + Add permission,-cancel Permission, = Assign a permission. chmod 777/home/hello.c

View Directory size du Du/home

View current absolute path pwd pwd

Compress unzip command *.gz--gzip command compressed file, *.bz2--bzip2 command compressed file, *.tar---Tar command package file *.tar.bz2---Tar command package bzip2 compressed file

Gzip Compress unzip the file gzip/root/hello.c The result is hello.c.gz decompression gzip-d/root/hello.c.gz

BZIP2 compressed Extract file bzip2/root/hello.c hello.c.bz2 decompression bzip2-d/root/hello.c.bz2

Package Command Tar

Tar cvf tmp.tar/tmp (package directory as a file) tar xvf Tmp.tar unpack the files

Tar cvzf tmp.tar.gz/tmp (Package the catalog and gzip compress) tar ivzf tmp.tar.gz unpack the files

Tar cvzf tmp.tar.bz2/tmp tar ivzf tmp.tar.bz2

Disk Management commands:

Loading CD Mount Mount/dev/cdrom/mnt

Unmount the disc umount umount/mnt

Create a new file Touch touch NewFile

View File Size files NewFile

File Link ln hard link ln oldfile hlink soft link ln-s oldfile slink soft-hard link difference and contact:

Find command:

To be Continued ...

User and User Group field analysis:

Linux is a multi-user OS, where users have the information and information to save.

One row of records in/etc/passwd corresponds to a user, each row is divided into seven fields

Eg:root:x:0:0:root:/root:/bin/...

1 User name, 2 user password, 3 UID (user identifier), 4 GID (user group), 5 user name, 6 user home directory, 7 user's command parser

The system administrator UID is 0, the normal user uid is 500--6000; The system user UID is 1--499.

File attribute Analysis:

Linux is a typical multi-user system, in order to protect the security of the system, different users access to the same file permissions to make provisions

EG-RWX|R-X|-WX 1 root root 890 Nov 7 22:41 config

1 file access 0 bit file type, '-' normal file; 1-3bit file owner access rights, 4-6bit file group access rights, 7-9bit other user access rights. Note: r: Readable, W: writable, x: Execute.

2 Files 3 file owner 4 file belongs to Group 5 file The University 6 file creation time 7 filename

Summary of common common commands for Linux

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.