linux回到桌面的命令符_1.4Linux基础命令—cd,pwd,ls,stat,cat,file,echo,which,whatis

ae0ae2fc502e46a473f37fe3d1c6653c.png

1.4Linux基础命令—cd,pwd,ls,stat,cat,file,echo,which...

Linux基础命令——cd

目录:

当前目录或工作目录

主目录或家目录:HOME

root: /root

普通用户:/home/USERNAME

例如:/home/tom

~ 用户的家目录

cd命令:chang directory

切换工作目录

回到当前用户的家目录

~]# cd 

~]# cd ~

切换至指定用户的主目录

~]# cd ~USERNAME

在上一次目录和当前目录之间来回切换

~]# cd -

当前目录用.表示

~]# cd .

当前目录的父目录用..表示

~]# cd ..

相关的环境变量:

PWD 保存了当前目录;

OLDPWD 上一次所在的目录;

pwd命令:显示当前目录

Print the name of the current working directory

~]# pwd/root

ls命令:显示指定路径下的文件列表

list directory contents

ls [OPTION]... [DIR]...-a,--all 显示所有文件,包括隐藏文件;-l 长格式-h,--human-readable 单位换算-d 显示目录自身的相关属性,通常与-l一起使用;-r,--reverse 逆序显示-R,--recursive 递归显示~]# ls -ld /rootdr-xr-x---. 26 root root 4096 12月 7 12:10 /root

stat命令:获取指定文件的元数据

display file or file system status

stat [OPTION]... FILE...

~]# stat /etc/passwd

cat,tac命令:查看文件内容命令

concatenate files and print on the standard output

 cat [OPTION]... [FILE]...-E 显示行结束符$-n 对显示出的每一行进行编号~]# cat -n /etc/issue 1CentOS release 6.5 (Final) 2Kernel  on an m 3~]# cat -E /etc/issueCentOS release 6.5 (Final)$Kernel  on an m$$~]# tac /etc/issueKernel  on an mCentOS release 6.5 (Final)

file命令:查看文件的类型命令

determine file type

file /PATH/TO/SOMEFILE

~]# file /etc/issue/etc/issue: ASCII text

echo命令:回显命令

display a line of text

-n 禁止自动添加换行符号;-e 允许使用转义符; 换行 制表符echo "$VAR_NAME" 变量会替换,双引号为弱引用echo ‘$VAR_NAME' 变量不会替换,单引号为强引用~]# echo "$PWD"/root~]# echo '$PWD'$PWD

which命令:显示命令对应的程序文件路径

shows the full path of (shell) commands.

which [options] [--] programname [...]~]# which cat /bin/cat

whatis命令:使用mkwhatis命令将当前系统上所有的帮助手册及与之对应的关键字创建为一个数据库

search the whatis database for complete words.

whatis keyword ...~]# whatis manman (1) - format and display the on-line manual pagesman (1p) - display system documentationman (7) - macros to format man pagesman.config [man] (5) - configuration data for manman [manpath] (1) - format and display the on-line manual pagesman-pages (7) - conventions for writing Linux man page
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值