Linux Command Basics

Source: Internet
Author: User

Linux Command Basics

. Experimental objectives

Skilled basic commands

. Experimental steps

    1. Linux Command line Basics

[[email protected] ~]# ls//View list target content

[[email protected] ~]# ls-l//display in long format

[[email protected] ~]# ls-l/boot///Show boot content

[Email protected] ~]# ls-l/boot/root//

[[email protected] ~]# ls--color//show current directory

[Email protected] ~]# ls-l

[[email protected] ~]# ls-l-H//all lists, content size

[Email protected] ~]# LS-LH

[[email protected] ~]# ls-lhd/boot//home///Display directory properties and size

Tab key to practice yourself

Command Word tab/Path tab (/etc/sysconfig/network-scripts)/path debug

[Email protected] network-scripts]# shutdown \

> K \

> Now

[[Email protected] ~]# type help//internal

[email protected] ~]# Help

[[Email protected] ~]# type cd ls

[[email protected] ~]# Help CD

[[email protected] ~]# ls--help//view external command

[[email protected] ~]# manpath//man manual page storage location//help information

[[email protected] ~]# makewhatis//Generate Database

[Email protected] ~]# Whatis passwd

[[email protected] ~]# man-f passwd//View specific back passwd This command those format help

[[email protected] ~]# man 5 passwd//passwd file Help

2. Operation of the underlying command

[[Email protected] ~]# Date//View system time

Saturday, November 30, 2013 17:11:22 CST

[[Email protected]host ~]# Date 121009302013//month date hour minute year//mmddhhyyyy

December 10, 2013 Tuesday 09:30:00 CST

[Email protected] ~]# date +%y%m%d

20131210

[Email protected] ~]# date +%h:%m

09:33

[[email protected] ~]# Hwclock//View hardware time

August 20, 2014 Wednesday 11:31 45 sec -0.586464 seconds

[[Email protected] ~]# Date//View system time

Friday, October 10, 2014 12:34:32 CST

[[email protected] ~]# hwclock-w//The hardware clock is modulated to match the system clock

[[email protected] ~]# Hwclock//View hardware time

October 10, 2014 Friday 12:35 40 sec -0.289928 seconds

[[email protected] ~]# cal//view calendar information

[[email protected] ~]# cal 2012

[[email protected] ~]# Cal 8 2012

[[email protected] ~]# BC//Calculator

BC 1.06

Copyright 1991-1994, 1997, 1998, Free Software Foundation, Inc.

This is the free software with absolutely NO WARRANTY.

For details type ' warranty '.

8+3

11

10/2

5

10/3

3

scale=2

10/3

3.33

Quit

3. Basic management of directories and documents

[[email protected] ~]# pwd//Show me where I am (directory)

[Email protected] ~]# cd/etc/pki/ca/private/

[Email protected] private]# pwd

[[Email protected] private]# CD. Current directory

[Email protected] private]# pwd

[Email protected] private]# CD. Previous level Directory

[Email protected] ca]# pwd

[Email protected] ca]# CD.     /.. Previous level of the previous level of the catalog

[Email protected] etc]# pwd

[[Email protected] etc]# CD-//previous working directory

[Email protected] ca]# pwd

[[Email protected] ca]# CD ~//"Current user identity" home directory

[Email protected] ~]# pwd

[Email protected] ~]# cd/etc/sysconfig/network-scripts/

[[Email protected] network-scripts]# CD

[Email protected] ~]# pwd

[Email protected] ~]# cd/boot/

[[email protected] boot]# ls

[[email protected] boot]# ls-l//long format display

[[email protected] boot]# ls-a//Except not shown, and ... Directories, others are the same as-a

[[email protected] boot]# ls-a//view all files (including hidden files)

[[email protected] boot]# ls-ld/boot//directory Properties

[[email protected] boot]# ls-l//long format display

[[email protected] boot]# LS-LH//display information in byte units (K, M, etc.)

[[email protected] boot]# ls

[[email protected] boot]# ls-r//recursive display content

[Email protected] boot]# cd/opt/

[[email protected] opt]# ls

[[email protected] opt]# Touch file1.txt//new file

[[email protected] opt]# ls

[email protected] opt]# Touch file2.txt

[[email protected] opt]# ls

[email protected] opt]# Touch file3.txt

[[email protected] opt]# ls

[email protected] opt]# Touch filea.txt fileb.txt filec.txt

[email protected] opt]# Touch file12.txt

[email protected] opt]# Touch file123.txt

[email protected] opt]# Touch fileab.txt

[[email protected] opt]# ls

[[email protected] opt]# ls file*//* matches any number of characters

[[email protected] opt]# ls file? ?: Match a single character

[[email protected] opt]# ls file?????

[[email protected] opt]# ls file??. Txt

[[email protected] opt]# ls file?. Txt

[[email protected] opt]# ls

[[email protected] opt]# ls file[0-9].txt//[a-z]: matches multiple consecutive characters

In one of

[[email protected] opt]# ls file[0-9][0-9].txt//{a,min,xy}//matching connection

Continue multiple characters

[[email protected] opt]# ls file??. Txt

[[email protected] opt]# ls file{1,ab,12}.txt

[[email protected] opt]# ls file{1,ab,12,abc}.txt

########################################

[[email protected] opt]# du-sh/boot//etc/pki///File size

[[email protected] opt]# mkdir 1406//Create folder

[[email protected] opt]# ls

[Email protected] opt]# mkdir ABC mp4 mp3

[[email protected] opt]# ls

[[email protected] opt]# mkdir-p aaa/bbb/ccc/ddd//[/path/] Directory name

Recursive creation

[[email protected] opt]# Ls-r AAA

[Email protected] opt]# mkdir-p/test1 data/mp4 mp3

[Email protected] opt]# Ls-ld/test1/data/mp3

[Email protected] opt]# ls-l file1.txt

[email protected] opt]# Touch file1.txt

[Email protected] opt]# ls-l file1.txt

[Email protected] opt]# ls-l/sbin/network

[Email protected] opt]# ln-s/usr/sbin/system-config-network-tui

/sbin/network//Create links

[Email protected] opt]# ls-l/sbin/network

[Email protected] opt]# Ls/root/file1.txt

[[email protected] opt]# CP file1.txt/root///Copy file

[Email protected] opt]# Ls/root/file1.txt

[[email protected] opt]# ls

[email protected] opt]# CP aaa/root/

[Email protected] opt]# LS/ROOT/AAA

[[email protected] opt]# cp-r aaa/root///recursively copy entire directory

[Email protected] opt]# LS/ROOT/AAA

[Email protected] opt]# Ls/root/file1.txt

[email protected] opt]# CP file1.txt/root/

[[email protected] opt]# cp-f file1.txt/root///forced overlay not prompted

[[email protected] opt]# alias

[Email protected] opt]# Unalias CP

[[email protected] opt]# alias

[Email protected] opt]# cp-f file1.txt/root/

[Email protected] opt]# \cp-f file1.txt/root/

[[email protected] opt]# ls file2.txt

[[Email protected] opt]# RM file2.txt//delete file

[[email protected] opt]# ls file2.txt

[[email protected] opt]# ls mp4/

[Email protected] opt]# ls-ld mp4

[Email protected] opt]# RM mp4

[Email protected] opt]# rm-r mp4

. Result validation

. Summary of issues and experiences

1. Shortcut keys

Ctrl + u: emptying to the beginning of the line

Ctrl + K: Empty to end of line

Ctrl + L: Empty the entire screen

Ctrl + C: Discard the currently edited command line

2. Get Help commands

Type: View internal commands and external commands

Help internal command results appear builtion other external commands

External command--help

The man command is suitable for finding external commands, and if finding internal commands is the shell itself, the result is the same

# Manpath

# Makewhatis Build Database

# man-f keyword = # whatis keyword to see what format help is supported by this command followed by

Numbers can help us understand or directly query the relevant information

1 instructions or executable files

5 File formats

8 instructions available to system administrators

# man 5 passwd

3. View System aliases

Alias

# alias Byebye= "Shutdown-h Now" custom Alias

# Unalias Byebye de-alias

4. Create a soft link

Ln-s source Target (source must be an absolute path)

[Email protected] opt]# ln-s/usr/sbin/system-config-network-tui

/sbin/network//Create links

[Email protected] opt]# ln-s/usr/sbin/system-config-network-tui \

>/sbin/network

5. View the file directory size

Du-sh

6. View Files and directories

-A View all files (including hidden files)

-L = ll long format display

-LD Long Format Display directory

-LH display information in byte units (K, M, etc.)

-R recursive display of content

Wildcard characters:

*: matches any number of characters

?: Match a single character

[N-m]: matches one of several consecutive characters

{a,x,y}: matches multiple characters that are not contiguous

7. Date to view system time

Date +%y%m%d

Date +%h:%m

Date mmddhhmmyyyy

Hwclock Viewing hardware time

Hwclock-s adjust the system clock to match the hardware clock

Hwclock-w adjust the hardware clock to match the system clock

Cal View calendar Information

BC Calculator

This article is from the "9255610" blog, please be sure to keep this source http://9265610.blog.51cto.com/9255610/1558279

Linux Command Basics

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.