Basic Linux Command explanation

Source: Internet
Author: User

CD command

The CD (option) (parameter) syntax is used as follows:

CD into the user's home directory;
CD ~ Enter the user's home directory;
CD- Returns the directory where the directory was before it entered;
CD.. Return to the parent directory;
CD.. /.. return to the top level two directory;

PWD command

The PWD (option) (parameter) syntax is used as follows:

The pwd displays the current location, and the following command outputs the current position under/root.

[Email protected] ~]# pwd
/root

Cat command

The Cat (option) (parameter) syntax is used as follows:

Cat Zhan (displays the contents of the file Zhan)
Cat Zhan1 zhan2 (together showing Zhan1 and zhan2 content)
cat Zhan1 zhan2 > Zhan3 (merging Files of ml and M2 into file files)

ls command

The LS (option) (parameter) syntax is used as follows:

Show hidden files not included in current directory

[[email protected] ~]# ls
Zhan

Show current directory including hidden files

[Email protected] ~]# ls-a
. . bash_history. Bash_profile. Cache. mysql_history. pydistutils.cfg. Viminfo
.. . bash_logout. bashrc. cshrc. Pip. TCSHRC Zhan

Displays the file under the current file in column line format

[Email protected] ~]# ls-1
Fu
Zhan

Print user uid and GID

[Email protected]/]# ls-n
Total 68
Drwxr-xr-x 2 0 0 4096 Jul 2 14:21 Backup
lrwxrwxrwx 1 0 0 7 Usr/bin Bin--
Dr-xr-xr-x. 4 0 0 4096 June 15:44 Boot
Drwxr-xr-x 4 0 0 4096 June 15:20 data
Drwxr-xr-x 0 0 3040 June 15:30 Dev
Drwxr-xr-x. 0 0 4096 Jul etc
Drwxr-xr-x. 6 0 0 4096 17:26 Home
lrwxrwxrwx 1 0 0 7 usr/lib Lib--
lrwxrwxrwx 1 0 0 9 lib64-usr/lib64
DRWX------. 2 0 0 16384 Lost+found
Drwxr-xr-x. 2 0 0 4096 5 Media
Drwxr-xr-x. 2 0 0 4096 Nov 5 mnt
Drwxr-xr-x. 2 0 0 4096 Nov 5 opt
Dr-xr-xr-x 111 0 0 0 June 15:29 proc
Dr-xr-x---. 6 0 0 4096 Jul 10:28 root
Drwxr-xr-x 0 0 June 17:48 Run
lrwxrwxrwx 1 0 0 8 sbin-usr/sbin
Drwxr-xr-x. 2 0 0 4096 Nov 5 SRV
Dr-xr-xr-x 0 0 0 June 23:29 Sys
DRWXRWXRWT. 8 0 0 4096 Jul 09:12 tmp
Drwxr-xr-x. 0 0 4096 usr
Drwxr-xr-x. 0 0 4096 June 23:30 var

List the most detailed information about files and folders

[Email protected] ~]# ls-l
Total 8
Drwxr-xr-x 2 root root 4096 Jul 10:28 Fu
Drwxr-xr-x 6 root root 4096 Jul 10:22 Zhan

List files and categorize them by color

[[email protected] usr]# ls--color=auto
Bin etc Games include Lib Lib64 libexec local sbin share src tmp zhan

Touch command

The Touch (option) (parameter) syntax is used as follows:

An empty file was created in the current directory Linux

[[email protected] ~]# Touch Linux

Madir command

The mkdir (option) (parameter) syntax is used as follows:

Sub-directory Zhanchenglong is established under directory/usr/local, and only the file owner has read, write, and Execute permissions, and no one else has access

[Email protected] ~]# mkdir-m 700/usr/local/zhanchenglong

In the current directory to establish Linux and Linux under the Linux1 directory, the permissions are set to the main file readable, write, execute, the same group of users can read and execute, other users do not have access to

[Email protected] ~]# mkdir-p-M 750/linux/linux1

RM command

The RM (option) (parameter) syntax is used as follows:
Options
-D: Delete the hard connection data of the directory you want to delete to 0, delete the directory;
-F: Forcibly deleting files or directories;
-I: Ask the user before deleting an existing file or directory;
-R or-R: Recursive processing, all files under the specified directory are processed in conjunction with subdirectories;
--preserve-root: Do not recursively operate the root directory;
-V: Displays the detailed execution of the instruction.

Delete Files Zhan and Zhanhanlin in the current directory

[Email protected] ~]# RM-RF fu/zhanhanlin/

MV Command

The MV (option) (parameter) syntax is used as follows:

Rename file Zhan to Fu

[Email protected] ~]# MV Zhan/fu

Move all files in the directory/root/fu to the current directory (in. Representations):

[Email protected] ~]# mv/root/fu/*.

CP command

The CP (option) (parameter) syntax is used as follows:

Copy the file Zhan to the directory/root/and rename it to Zhanhanlin

[email protected] ~]# CP Zhan/root/zhanhanlin

Copy all files and their subdirectories under directory/root/fu to the directory/root/lisi

[Email protected] ~]# cp-r/root/fu//root/lisi

Basic Linux Command explanation

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.