本文共 9458 字,大约阅读时间需要 31 分钟。
[liu@localhost ~]$ su - root密码:[root@localhost ~]
[root@localhost ~]# ifconfigens33: flags=4163mtu 1500 inet 192.168.100.47 netmask 255.255.255.0 broadcast 192.168.100.255 inet6 fe80::c461:4388:8c74:21af prefixlen 64 scopeid 0x20 ether 00:0c:29:d7:54:49 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 38 bytes 5021 (4.9 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0lo: flags=73 mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10 loop txqueuelen 1000 (Local Loopback) RX packets 608 bytes 52896 (51.6 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 608 bytes 52896 (51.6 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0virbr0: flags=4099 mtu 1500 inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255 ether 52:54:00:2c:fd:50 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@localhost ~]# hostnamelocalhost.localdomain **localhost为主机名**
[root@localhost ~]# pwd/root
[root@localhost ~]# whoamiroot
[root@localhost ~]# date2021年 04月 22日 星期四 21:41:30 CST
[root@localhost ~]# cal 四月 2021 日 一 二 三 四 五 六 1 2 3 4 5 6 7 8 9 1011 12 13 14 15 16 1718 19 20 21 22 23 2425 26 27 28 29 30
[root@lrz ~]# systemctl stop firewalld.service
[root@lrz ~]# systemctl status firewalld.service● firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled) Active: inactive (dead) since 四 2021-04-22 21:56:17 CST; 35s ago Docs: man:firewalld(1) Process: 6196 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS) Main PID: 6196 (code=exited, status=0/SUCCESS)4月 22 21:31:13 localhost.localdomain systemd[1]: Starting firewalld - dynamic fir....4月 22 21:31:13 localhost.localdomain systemd[1]: Started firewalld - dynamic fire....4月 22 21:56:16 lrz systemd[1]: Stopping firewalld - dynamic firewall daemon...4月 22 21:56:17 lrz systemd[1]: Stopped firewalld - dynamic firewall daemon.Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost ~]# hostname lrz[root@localhost /]# su - liu上一次登录:四 4月 22 21:31:25 CST 2021:0 上[liu@lrz ~]$ su - root
[root@lrz ~]# enableenable .enable :enable [enable aliasenable bgenable bindenable breakenable builtinenable callerenable cdenable commandenable compgenenable completeenable compoptenable continueenable declareenable dirsenable disownenable echoenable enableenable evalenable execenable exitenable exportenable falseenable fcenable fgenable getoptsenable hashenable helpenable historyenable jobsenable killenable letenable localenable logoutenable mapfileenable popdenable printfenable pushdenable pwdenable readenable readarrayenable readonlyenable returnenable setenable shiftenable shoptenable sourceenable suspendenable testenable timesenable trapenable trueenable typeenable typesetenable ulimitenable umaskenable unaliasenable unsetenable wait
[root@lrz ~]# type pwdpwd 是 shell 内嵌[root@lrz ~]# type hostnamehostname 是 /bin/hostname
[root@lrz ~]# which whoami/bin/whoami[root@lrz ~]# which hostname/bin/hostname
[root@lrz ~]# setenforce 0
[root@lrz ~]# cd /[root@lrz /]# lsbin dev home lib64 mnt proc run srv tmp varboot etc lib media opt root sbin sys usr
[root@lrz /]# su --help用法: su [选项] [-] [USER [参数]...]将有效用户 id 和组 id 更改为 USER 的 id。单个 - 视为 -l。如果未指定 USER,将假定为 root。选项: -m, -p, --preserve-environment 不重置环境变量 -g, --group <组> 指定主组 -G, --supp-group <组> 指定一个辅助组 -, -l, --login 使 shell 成为登录 shell -c, --command <命令> 使用 -c 向 shell 传递一条命令 --session-command <命令> 使用 -c 向 shell 传递一条命令 而不创建新会话 -f, --fast 向shell 传递 -f 选项(csh 或 tcsh) -s, --shell若 /etc/shells 允许,则运行 shell -h, --help 显示此帮助并退出 -V, --version 输出版本信息并退出更多信息请参阅 su(1)。 命令> 命令> 组> 组>
通过su -h依旧可以。
[root@lrz /]# help pwdpwd: pwd [-LP] 打印当前工作目录的名字。 选项: -L 打印 $PWD 变量的值,如果它命名了当前的 工作目录 -P 打印当前的物理路径,不带有任何的符号链接 默认情况下,`pwd' 的行为和带 `-L' 选项一致 退出状态: 除非使用了无效选项或者当前目录不可读,否则 返回状态为0。
[root@lrz /]# enenable enchant-lsmod env enchant enscript envsubst
查看其他同理
[root@lrz /]# hh2ph hcidump hexdump hunspellhalt hcitool history hwclockhandle-sshpw hdmv_test host hypervfcopydhangul hdsploader hostid hypervkvpdhardlink head hostname hypervvssdhash help hostnamectl hciattach hesinfo hpcups-update-ppds hciconfig hex2hcd hpijs
[root@lrz /]# helTab到[root@lrz /]# help
[root@lrz /]# help\> help\>
其他效果不赘述
[root@lrz /]# helpGNU bash, 版本 4.2.46(2)-release (x86_64-redhat-linux-gnu)这些 shell 命令是内部定义的。请输入 `help' 以获取一个列表.输入 `help 名称' 以得到有关函数`名称'的更多信息.使用 `info bash' 来获得关于 shell 的更多一般性信息使用 `man -k' 或 `info' 来获取不在列表中的命令的更多信息.名称旁边的星号 (*) 意味着该命令被禁用. job_spec [&] history [-c] [-d 偏移量] [n] 或 his> (( 表达式 )) if 命令; then 命令; [ elif 命令; > . 文件名 [参数] jobs [-lnprs] [任务声明 ...] 或 jo> : kill [-s 信号声明 | -n 信号编号> [ 参数... ] let 参数 [参数 ...] [[ 表达式 ]] local [option] 名称[=值] ... alias [-p] [名称[=值] ... ] logout [n] bg [任务声明 ...] mapfile [-n 计数] [-O 起始序号] [> bind [-lpvsPVS] [-m 键映射] [-f 文��> popd [-n] [+N | -N] break [n] printf [-v var] 格式 [参数] builtin [shell 内嵌 [参数 ...]] pushd [-n] [+N | -N | 目录] caller [表达式] pwd [-LP] case 词 in [模式 [| 模式]...) 命��> read [-ers] [-a 数组] [-d 分隔符] > cd [-L|[-P [-e]]] [dir] readarray [-n 计数] [-O 起始序号]> command [-pVv] 命令 [参数 ...] readonly [-aAf] [name[=value] ...] or r> compgen [-abcdefgjksuv] [-o 选项] [-A> return [n] complete [-abcdefgjksuv] [-pr] [-DE] [-o> select NAME [in 词语 ... ;] do 命令> compopt [-o|+o 选项] [-DE] [名称 ...> set [-abefhkmnptuvxBCHP] [-o option-nam> continue [n] shift [n] coproc [名称] 命令 [重定向] shopt [-pqsu] [-o] [选项名 ...] declare [-aAfFgilrtux] [-p] [name[=value> source 文件名 [参数] dirs [-clpv] [+N] [-N] suspend [-f] disown [-h] [-ar] [任务声明 ...] test [表达式] echo [-neE] [参数 ...] time [-p] 管道 enable [-a] [-dnps] [-f 文件名] [名�> times eval [参数 ...] trap [-lp] [[参数] 信号声明 ...] exec [-cl] [-a 名称] [命令 [参数 .> 真 exit [n] type [-afptP] 名称 [名称 ...] export [-fn] [名称[=值] ...] 或 expo> typeset [-aAfFgilrtux] [-p] name[=value> 伪 ulimit [-SHacdefilmnpqrstuvx] [限制] fc [-e 编辑器名] [-lnr] [起始] [��> umask [-p] [-S] [模式] fg [任务声明] unalias [-a] 名称 [名称 ...] for 名称 [in 词语 ... ] ; do 命令;> unset [-f] [-v] [名称 ...] for (( 表达式1; 表达式2; 表达式> until 命令; do 命令; done function 名称 { 命令 ; } 或 name ()> variables - 一些 shell 变量的名��> getopts 选项字符串 名称 [参数] wait [编号] hash [-lr] [-p 路径名] [-dt] [名称 > while 命令; do 命令; done help [-dms] [模式 ...] { 命令 ; }
其他不做赘述。
[root@lrz /]# cd /home[root@lrz home]#
[root@lrz home]# cd ../[root@lrz /]#
回到上两层
[root@lrz /]# cd /home[root@lrz home]# lsliu[root@lrz home]# cd /home/liu[root@lrz liu]# cd ../../[root@lrz /]#
[root@lrz home]# cd /home/liu[root@lrz liu]# cd ../../[root@lrz /]# cd /bin[root@lrz bin]# cd /home/liu[root@lrz liu]# cd ../[root@lrz home]# cd ../
[root@lrz /]# cd /bin[root@lrz bin]# cd ../home/liu[root@lrz liu]#
相对路径就是相对当前你所在路径开始算。
绝对路径是从linux最底层的根(/)开始算。 其中:在Linux中,绝对路径是从/(根目录)开始的,路径最前面是/的话就是绝对路径。 相对路径是直接输入当前路径下的文件夹或者以 . 或 … 开始算的,.表示用户当前操作所处的位置,… 表示上一级目录。 举个例子: /home/oracle 这个路径就是绝对路径 ./home/oracle 这个就是相对路径,例如现在在/test路径下,此条路径换算成绝对路径为/test/home/oracle …/home/oracel 这个也是相对路径,例如现在在/test路径下,此条路径换算成绝对路径为:/home/oracel 注意后面两个的对比,…是回到上一级然后在往后算。 使用pwd命令可以查看当前所在的绝对路径。‘ 如题中提出的问题,答案如下: 由于不清楚相对路径是相对于哪个路径,这里默认在/目录下。 用相对路径名从usr/bin跳到/home/staff/john/project 答:cd …/…/home/staff/john/project 或者 cd /home/staff/john/project 用绝对路径名从usr/bin跳到/temp 答:cd …/…/temp 或者 cd /temp 用相对路径名从usr/bin跳到/etc/rc.d 答:cd …/…/etc/rc.d 或者 cd /etc/rc.d 跳转路径可以直接输入绝对路径[root@lrz home]# mkdir a[root@lrz home]# mkdir b[root@lrz home]# lsa b liu
[root@lrz home]# cd -/home/liu[root@lrz liu]#
转载地址:http://dffd.baihongyu.com/