Intro
Linux以命令行工具见长。其众多的工具中,尚有很多平日里未曾用到的地方。
有不了解的可以上网查阅,但也可以利用其本身自带的帮助工具进行查阅。
以pwd
为例,现在我们来了解学习pwd
这个命令。
知道命令在哪
whereis pwd
pwd都在路径下存在?which pwd
使用的是哪个位置的pwd
操作记录如下:
wyj@g40:~$ whereis pwd
pwd: /bin/pwd /usr/include/pwd.h /usr/share/man/man1/pwd.1.gz
wyj@g40:~$ which pwd
/bin/pwd
知道命令的用途,及详细用法。
whatis pwd
pwd命令是什么(其实就是man中的第一行Name信息)?pwd --help
查看pwd的帮助信息,包含描述及选项参数的信息。man pwd
man为manual
,手册。查看pwd的操作手册。信息最全。
操作记录如下:
wyj@g40:~$ whatis pwd
pwd (1) - print name of current/working directory
wyj@g40:~$ pwd --help
pwd: pwd [-LP]
Print the name of the current working directory.
Options:
-L print the value of $PWD if it names the current working
directory
-P print the physical directory, without any symbolic links
By default, `pwd' behaves as if `-L' were specified.
Exit Status:
Returns 0 unless an invalid option is given or the current directory
cannot be read.
wyj@g40:~$ man pwd
wyj@g40:~$
其他
type
显示命令类型的信息
wyj@g40:~$ type pwd
pwd is a shell builtin
wyj@g40:~$ type ll
ll is aliased to `ls -alF'
wyj@g40:~$ type shutdown
shutdown is /sbin/shutdown
file
测定文件类型
wyj@g40:~/Desktop$ whatis file
file (1) - determine file type
wyj@g40:~/Desktop$ file /sbin/shutdown
/sbin/shutdown: symbolic link to /bin/systemctl
wyj@g40:~/Desktop$ file CSDN.md
CSDN.md: UTF-8 Unicode text
du
查看文件大小
wyj@g40:~$ whatis du
du (1) - estimate file space usage
wyj@g40:~$ du /bin/ls --human-readable
132K /bin/ls
stat
查看文件状态
wyj@g40:~$ whatis stat
stat (1) - display file or file system status
stat (2) - get file status