Linux Learning Log-file processing commands

Source: Internet
Author: User
Tags create directory

1. User's classification and su Switch User's usage.

1): Super user with # identification, ordinary user with $ logo.

2): Switching between users, suppose we have a hahaha user, from the root->hahaha User's switch to use to su hahaha command , the conversion from hahaha->root , just su on it.

2. Add Users (problem)

Useradd user1 This command is implemented to increase the functionality of user1 users

3. Set Password (problem)

4. Find Files or directories

ls [ option ] [ file or directory ]

1) option -A is to show all files, including hidden files

2) option - l is to display details of all files

3) option -lh Show All files in a humane way

Note: When the- l Display, the first bit is the file type that is displayed,- is a normal file,D is a directory,b is a block device file , C is a character device file,l is a link file,p is a pipe file , S is Socket file.






5. Change the working directory

cd/home/user/0718 switch to this directory

CD/ Yes switch to the root directory

The CD is switched to the current home directory

CD- is the switch to the previous directory




6. Show current working directory:PWD

7. Create directory: mkdir [ catalogue ]

Note: The directory is created under the current directory . in the /home/hahaha Directory creates a 中文版 the directory

8. Delete Empty directory : rmdir [ directory ] ( not used)

Delete the English directory You just created note: Must be an empty directory




9. copy files or directories : CP [ file or directory ]

1) Copy files

There are two cases, one that needs to be renamed, and one that does not need to be renamed. Suppose we will . X0-lock files are copied to the /home/hahaha/chinese directory and do not need to be renamed

First case :



there is one in the/ tmp directory . X0-lock file renamed to /home/hahaha/chinses , renamed to hello.c

Second case:





There are in the/ tmp directory . X0-lock files are copied to /home/hahaha/chinese

2) copy directory

Note that when copying a directory, subdirectories and files in the original directory are copied in the past, and the target must be a directory to copy the Japan directory to Chinese the directory.

Cp-r/home/hahaha/japan/home/hahaha/chinese copies the Japan directory to the Chinese directory.




10. Cut (rename) file or directory : MV [ file or directory ]

Note: The cut and move and delete is different, in the directory operation, not in the add- R, if the second parameter is a file, then the completion of the renaming command, there is only one file, that is, the following file, if the second parameter is a directory, then the completion of the Cut command, The original file or directory is moved to the destination directory.

Renaming command: Thetmp directory originally has a called . X11-unix file, now renamed hello.h file

Before renaming:



After renaming :





Catalog Cut command: Move the /home/hahaha/chinese/haha directory to the/home/hahaha/japan directory

Delete a file or directory : RM (remove) [ file or directory ]

Delete file: To delete the hello.c file under Chinese

Rm-f/HOME/HAHAHA/CHINESE/HELLO.C




Delete directory: To delete the Japan directory

Rm-rf/home/hahaha/chinese/japan

Note: To add- R will remove all directories from Japan and below



Linux Learning Log-file processing commands

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.