1.查看根目录下有哪些内容?
[root@localhost /]# ls
bin dev home lib64 mnt proc run srv tmp var
boot etc lib media opt root sbin sys usr
2. 切换到tmp目录,并且显示其路径
[root@localhost /]# cd /tmp
[root@localhost tmp]# pwd
/tmp
3.查看etc目录下的selinux目录下有哪些内容,只查看其中config文件的字数
[zhangyue@localhost selinux]$ cd /
[zhangyue@localhost /]$ cd /etc/selinux
[zhangyue@localhost selinux]$ wc -c /etc/selinux/config
543 /etc/selinux/config
4.查看/root目录下的所有内容,包括隐藏文件
zhangyue@localhost /]$ su
密码:
[root@localhost ~]# ls /root -a
. .bash_history .bashrc .cshrc .tcshrc
.. .bash_logout .cache .dbus .xauth9Y81np
anaconda-ks.cfg .bash_profile .config initial-setup-ks.cfg
5./etc/services是一个目录还是普通文件?其它人有没有读、写权限??
答:/etc/services是一个普通文件,其它人只有读的权限,没有写和执行的权限
[root@localhost /]# ls -ld /etc/services
-rw-r--r--. 1 root root 670293 6月 7 2013 /etc/services
6.假设当前用户工作在/tmp目录下,切换到根目录用什么命令?切换到用户liming的家目录(假设系统里有一个用户liming)、切换到自己的家目录分别用什么命令??
答:cd /;cd~;cd~ liming。
7.读取文件/etc/services的内容
[root@localhost /]# cat /etc/services
或者用more(只能向前)分页查看纯文本文件
(回车换行,空格翻页,Q键退出)
less向前或向后浏览文件
8.读取文件/etc/services前5行内容和后10行的内容
[root@localhost /]# head -5 /etc/services
# /etc/services:
# $Id: services,v 1.55 2013/04/14 ovasik Exp $
#
# Network services, Internet style
# IANA services version: last updated 2013-04-10
[root@localhost /]# tail -10 /etc/services
3gpp-cbsp 48049/tcp # 3GPP Cell Broadcast Service Protocol
isnetserv 48128/tcp # Image Systems Network Services
isnetserv 48128/udp # Image Systems Network Services
blp5 48129/tcp # Bloomberg locator
blp5 48129/udp # Bloomberg locator
com-bardac-dw 48556/tcp # com-bardac-dw
com-bardac-dw 48556/udp # com-bardac-dw
iqobject 48619/tcp # iqobject
iqobject 48619/udp # iqobject
matahari 49000/tcp # Matahari Broker
9."$" "#" "." "/" ".." ,试说明这5个字符,在linux操作中分别有什么意义?
答:
- $为一般用户提示符,也可表示未尾的功能
- #为root的提示符,表示为超级用户;在shell中为注释
- .为当前目录
- /为当前用户根目录
- ..为当前目录的上级目录 /
10.当前root用户工作在/tmp目录下,若想切换到/tmp目录下的linux目录,切换的相对路径和绝对路径怎么写?若切换到根目录呢,可用什么命令去操作?
答:相对路径cd /linux ;绝对路径cd /tmp/linux;根目录cd /