linux 基础练习题
1、创建文件命令练习:
(1) 在/目录下创建一个临时目录test;
mkdir /test
(2)在临时目录test下创建五个文件,文件名分别为passwd,group,bashrc,profile,sshd_config;
cd /test
touch passwd
touch group
touch bashrc
touch profile
touch sshd_config
(3)在/test创建/etc/motd的软链接,文件名为motd.soft;创建/etc/motd的硬链接为motd.hard
ln -s /etc/motd /test/motd.soft
ln /etc/motd /test/motd.hard
2、重定向练习:
(1)将系统内核版本信息,发行版本信息,写入到/test/motd.soft文件中
echo uname -a
> /test/motd.soft
(2)将当前主机主机名,当前用户使用的shell信息追加到/test/motd.hard文件中
echo hostname
> /test/motd.hard
echo $SHELL >> /test/motd.hard
(3)将根目录下的文件的文件名写入/test/file文件中
echo ll /
> /test/file
(4)查看当前工作目录是否为/test目录,将当前工作目录的详细信息追加到/test/file文件中
pwd
echo pwd
>>/test/file
3、echo命令练习
(1)将当前时间添加至/test目录下的passwd,group,bashrc,profile,sshd_config文件中
echo date
>