Linux file system and basic commands (Prince have regrets.)

Source: Internet
Author: User
Tags ming uuid egrep

Linux file system and basic commands

Instructions and examples:

1.PWD: This command displays the working directory

[Email protected] sysconfig]# pwd

/etc/sysconfig

2.echo: This command displays the command back

[Email protected] sysconfig]# echo $PATH

/usr/lib64/qt3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root

3.CD: This command is a toggle command

[[Email protected] sysconfig]# CD

[[email protected] ~]# This example to switch home directory

[Email protected] etc]# CD ~

[[email protected] ~]# This command is also switch home directory

[Email protected] home]# CD ~ming

[[email protected] ming]# This command is to switch to the home directory of the specified user

[Email protected]/]# CD-

/root

[Email protected] ~]# CD-

/

[Email protected]/]# CD-

/root

[[email protected] ~]# switch back and forth between the last directory and the current directory ;

4.ls:

[[email protected] ~]# ls-a Show all files, including. and. Hidden files are included .

. Anaconda-ks.cfg. bash_logout. bashrc. config. lesshst. TCSHRC

.. . bash_history. Bash_profile. Cache. cshrc. SSH

[[email protected] ~]# ls-a Show almost all the files

Anaconda-ks.cfg. bash_logout. bashrc. config. lesshst. TCSHRC

. bash_history. Bash_profile. Cache. cshrc. SSH

[[email protected] ~]# ls-l listing the details of the file

Total 4

-RW-------. 1 root root 2639 Mar 4 21:30 anaconda-ks.cfg

[Email protected] ~]# ls-l

Total 4

-RW-------. 1 root root 2639 Mar 4 21:30 anaconda-ks.cfg

[[email protected] ~]# LS-LH This command to convert values in units

Total 4.0K

-RW-------. 1 root root 2.6K Mar 4 21:30 anaconda-ks.cfg

[[email protected] ~]# ls-ld/etc View the properties of the directory itself

Drwxr-xr-x. 119 root root 8192 Mar 6 11:52/etc

Ls-r Recursive display

[[email protected]/]# ls

Bin Dev Home Lib media opt root sbin sys usr Wen

Boot etc Li lib64 mnt proc run SRV tmp var

[[email protected]/]# ls-r Descending display

Wen usr sys sbin Root opt media lib home dev bin

var tmp srv run proc mnt lib64 li etc boot

5.cat:

[[email protected]/]# cat/etc/fstab display file contents


#

#/etc/fstab

# Created by Anaconda on Fri Mar 4 13:14:59 2016

#

# Accessible filesystems, by reference, is maintained under '/dev/disk '

# See mans Pages Fstab (5), Findfs (8), mount (8) and/or Blkid (8) for more info

#

UUID=2ADD5CE4-FBC0-4E3E-A6CA-4D43B052AA93/XFS Defaults 0 0

Uuid=31fe4ea9-d043-424b-9d64-254e40193750/boot XFS Defaults 0 0

UUID=C9FC5E6B-639A-46DC-BECD-F8D0D6AA6341/USR XFS Defaults 0 0

UUID=740E31FB-2FC2-4162-9FE5-171751ECD52E swap swap defaults 0 0

[[email protected]/]# cat-n/etc/fstab numbering the displayed rows

1

2#

3#/etc/fstab

4# Created by Anaconda on Fri Mar 4 13:14:59 2016

5#

6# Accessible filesystems, by reference, is maintained under '/dev/disk '

7# See mans Pages Fstab (5), Findfs (8), mount (8) and/or Blkid (8) for more info

8#

9uuid=2add5ce4-fbc0-4e3e-a6ca-4d43b052aa93/xfs defaults 0 0

uuid=31fe4ea9-d043-424b-9d64-254e40193750/boot xfs defaults 0 0

uuid=c9fc5e6b-639a-46dc-becd-f8d0d6aa6341/usr xfs defaults 0 0

uuid=740e31fb-2fc2-4162-9fe5-171751ecd52e Swap swap defaults

[[email protected]/]# cat-e/etc/fstab Display line terminator ($)

$

#$

#/etc/fstab$

# Created by Anaconda on Fri Mar 4 13:14:59 2016$

#$

# Accessible filesystems, by reference, is maintained under '/dev/disk ' $

# See mans Pages Fstab (5), Findfs (8), mount (8) and/or Blkid (8) for more info$

#$

UUID=2ADD5CE4-FBC0-4E3E-A6CA-4D43B052AA93/XFS Defaults 0 0$

Uuid=31fe4ea9-d043-424b-9d64-254e40193750/boot XFS Defaults 0 0$

UUID=C9FC5E6B-639A-46DC-BECD-F8D0D6AA6341/USR XFS Defaults 0 0$

UUID=740E31FB-2FC2-4162-9FE5-171751ECD52E Swap swap defaults 0 0$

6.TAC: This command is a reverse version of cat

[Email protected]/]# Cat/etc/fstab


#

#/etc/fstab

# Created by Anaconda on Fri Mar 4 13:14:59 2016

#

# Accessible filesystems, by reference, is maintained under '/dev/disk '

# See mans Pages Fstab (5), Findfs (8), mount (8) and/or Blkid (8) for more info

#

UUID=2ADD5CE4-FBC0-4E3E-A6CA-4D43B052AA93/XFS Defaults 0 0

Uuid=31fe4ea9-d043-424b-9d64-254e40193750/boot XFS Defaults 0 0

UUID=C9FC5E6B-639A-46DC-BECD-F8D0D6AA6341/USR XFS Defaults 0 0

UUID=740E31FB-2FC2-4162-9FE5-171751ECD52E swap swap defaults 0 0

[Email protected]/]# Tac/etc/fstab

UUID=740E31FB-2FC2-4162-9FE5-171751ECD52E swap swap defaults 0 0

UUID=C9FC5E6B-639A-46DC-BECD-F8D0D6AA6341/USR XFS Defaults 0 0

Uuid=31fe4ea9-d043-424b-9d64-254e40193750/boot XFS Defaults 0 0

UUID=2ADD5CE4-FBC0-4E3E-A6CA-4D43B052AA93/XFS Defaults 0 0

#

# See mans Pages Fstab (5), Findfs (8), mount (8) and/or Blkid (8) for more info

# Accessible filesystems, by reference, is maintained under '/dev/disk '

#

# Created by Anaconda on Fri Mar 4 13:14:59 2016

#/etc/fstab

#

7.file:

[[email protected]/]# file/etc/fstab This command is to view the type of file.

/etc/fstab:ascii text

8.date: This command displays the command for the system time

[[Email protected]/]# Date

Sun Mar 6 14:31:16 CST 2016

9.hwclock: This command is hardware time

[Email protected]/]# Hwclock

Sun Mar 02:32:42 PM CST-0.649588 seconds


Hwclock-s refers to the hardware and system synchronization

Hwclock-w refers to the system and hardware synchronization

10.cal: View calendar Commands

[[email protected]/]# cal

March 2016

Su Mo Tu We Th Fr Sa

1 2 3) 4 5

6 7 8 9 10 11 12

13 14 15 16 17 18 19

20 21 22 23 24 25 26

27 28 29) 30 31

types of files on the 11.linux system:

-: Regular file, sometimes using F logo;

d: catalog files;

B:block;

C:character devices;

L:symbolic link files; Symbolic link file;

P:pipe, Named Pipes;

S:SOKCET, socket file;

12.alias: command to name aliases

[[email protected]/]# alias cle= "Clear"

[[email protected]/]# alias

Alias cle= ' Clear '

Alias cp= ' Cp-i '

Alias egrep= ' Egrep--color=auto '

Alias fgrep= ' Fgrep--color=auto '

Alias grep= ' grep--color=auto '

Alias l.= ' ls-d. *--color=auto '

Alias ll= ' Ls-l--color=auto '

Alias ls= ' ls--color=auto '

Alias mv= ' Mv-i '

Alias rm= ' Rm-i '

Alias Which= ' Alias | /usr/bin/which--tty-only--read-alias--show-dot--show-tilde '

[[email protected]/]# Unalias CLE alias cancellation command

[Email protected]/]# CLE

-bash:cle:command not found

13.

To view a list of command history:

~]# history

Command usage:

History-c: Emptying the command history;

history-d OFFSET: Deletes the specified entry;

-A appends the current buffered history row to the history file

-N reads all unread rows from the history file

-R reads the history file and appends the contents to the History list

Invoke commands in the command history list for re-execution purposes:

!#: Once again execute the # command in the history list;

!! : To execute the last command once more;

! STRING: Executes the most recent command in the command history list that begins with the specified string;

14.


Shutdown

Shutdown [OPTIONS ...] [TIME] [WALL ...]

Options:

-H: Shutdown

-R: Restart

-C: Cancel the shutdown or restart operation that has not been performed

Time:

(1) hh:mm

(2) +m

15.

Which:

which [OPTIONS] [PROGRAMS]

-A: Displays all matching program files, not the first;

[Email protected]/]# which-a/etc/host*

/usr/bin/which:no host.conf in (/etc)

/usr/bin/which:no hostname in (/etc)

/usr/bin/which:no hosts in (/etc)

/usr/bin/which:no Hosts.allow in (/etc)

/usr/bin/which:no Hosts.deny in (/etc


16.whereis:

Whereis [Options] name ...

-B Search only displays specific paths for binaries

[Email protected]/]# Whereis-b/etc

ETC:/usr/local/etc

-M Search only for manuals

[Email protected]/]# WHEREIS-M/etc

Etc:[[email protected]/]


17.who:

Who-show who's logged on

who [OPTION] ...

-R: Displays the operating level;

[Email protected]/]# Who-r

Run-level 3 2016-03-06 10:41


-B: The time the system starts;

[Email protected]/]# Who-b

System Boot 2016-03-06 18:40

W:

W-show who was logged on and what they was doing.

w [options] user [...]

[Email protected]/]# W

15:02:16 up 4:25, 2 users, load average:0.00, 0.01, 0.05

USER TTY from [email protected] IDLE jcpu PCPU

Root tty1 13:57 1:04m 0.21s 0.21s-bash

Root pts/0 192.168.1.110 13:58 0.00s 1.41s 0.01s

WHOAMI:

Etc:[[email protected]/]# WhoAmI

Root

Whoami-print effective UserID


This article is from the "Li Wenming blog" blog, make sure to keep this source http://liwenming18.blog.51cto.com/11068518/1748058

Linux file system and basic commands (Prince have regrets.)

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.