Linux System Command (b)

Today continued on the command (a) remaining in command, two combined, enormous power.
Shell: converting the identified user instruction into machine instructions (interpreter).
Linux System Command (b)

Absolute and relative paths

Is the absolute path to the root directory "/" as a starting point, the beginning of its directory of "/" symbol; a relative path is the current directory (as shown in the etc directory) as a starting point, the beginning of the directory file directly with the directory name, no with the "/" symbol.
Linux System Command (b)

Command: su (space) user name

You can replace the user login name, that is, you can switch back and forth between super administrators and ordinary users.
As can be seen in the figure below, the super administrator's home directory is in the root directory, while the average user's home directory in your home directory. Pwd is to look at the absolute path of the command, linux command mentioned in (a) in.

Linux System Command (b)

Font color represents the meaning of the document

Black: Data File

Green: the executable file (shell script)

Red: archive

Blue: directory (folder)

Sky Blue: Soft linked files (shortcuts)

Pink: Pictures

Linux System Command (b)

Additional knowledge:

Linux System Command (b)

Linux System Command (b)
The figure is set an alias for the command ls -alh myls, and myls enables ls -alh function, alias must be remembered.
Linux System Command (b)

Statistical catalog and space occupancy -du

Statistical specified directory (or file) the size of disk space occupied by
du [options] [file or directory]
1. Command: du -ah, with units display size of all files and directories under the directory where the total space
Linux System Command (b)
2. Command: du - sh, with units of directory displays the total
Linux System Command (b)
Note: command a, s, h can not all be combined with, a and s command features conflict. The system can only display the total size, and display each item. To pay special attention.

Create a new directory -mkdir

1.命令:mkdir abc,即可创建名称为abc的新目录
Linux System Command (b)
2.命令:mkdir 111 222 333,即可一次创建多个新目录
Linux System Command (b)
3.嵌套创建新目录:命令:mkdir -p test/share/demo/,即不仅在home目录下创建了test目录,而且在test目录下创建了share目录,还在share目录下创建了demo目录。
Linux System Command (b)

创建空文件-touch

更新文件的时间标记
经常用于创建多个新的空文件
touch 文件...
1.命令touch abc.txt,即创建了一个abc.txt空文件
Linux System Command (b)

2.创建多个路径空文件,文件与文件之间要用空格隔开。且严格注意路径为绝对路径还是相对路径。
Linux System Command (b)

创建有内容的文件

(1)vim /host/test/share/demo/demo03.txt
输入命令后在文件中编辑如下图,保存退出(不保存退出文件相当于没有创建,目录下找不到)
Linux System Command (b)
(2)echo “this is demo02” > /home/test/share/demo/demo02.tx

Linux System Command (b)

创建链接文件-ln

为文件或目录创建链接文件,类似于Windows系统的快捷方式。
Linux System Command (b)

(1)软链接
格式:ln -s (文件)(软链接)
删除源文件,链接打不开,显示没有文件。给它再创建一个同名文件后,链接即可以打开,但显示的是此次创建文件下的内容。
源文件移动到其它目录后,链接不可用。且改名字也会导致链接不可用。
(2)硬链接
格式:ln (文件)(硬链接)
删除源文件,链接可以打开,其中内容可查看。
硬链接相当于给源文件起了一个别名,删只是删除了别名。
源文件和硬链接的序列号一致。
移动文件-mv
格式:mv (源文件目录位置) (目标文件或目录)
将指定的文件或目录转移位置;
若源文件和目标文件地址相同,则移动命令相当于重命名。

复制文件-cp

命令格式:cp (源文件地址) (目标文件地址)
将源文件和内容一起复制到目标地址下;
保留原有权限不变,将文件复制到目标地址之下:格式为:cp -p (源文件地址) (目标文件地址)。

删除指定文件或目录-rm

rm (选项) 要删除的文件或目录
选项:-f(直接删除,没有提示)
-i(删除前会有提示)
-r(文件和快捷方式一起删除)

环境变量

Output Environment Variables command: echo $ PATH. Display system command file ,
usr / sbin file is put command administrator operations;
usr / bin command files is to put all users can operate.
1.which scouting external command file:
Linux System Command (b)
2 is used to find the file or directory:
Linux System Command (b)
the figure, "+" is exceeded means, -a is set and (if -o, is the intersection). Command meaning: look in the boot directory size exceeds 1024K and vmlin .. The file begins with the name.

Linux System Command (b)

Guess you like

Origin blog.51cto.com/14475593/2428995