RHEL7 Linux控制台与Shell命令详解

需积分: 13 1 下载量 88 浏览量 更新于2024-09-10 收藏 766KB PDF 举报
"02-RHEL7-Linux控制台使用与shell命令执行" 在RHEL7系统中,Linux控制台的使用是系统管理的基础,它包括桌面控制台、X-Windows图形界面以及字符控制台。字符控制台是RHEL7的核心组成部分,提供了多个独立运行的终端,允许用户在同一时间进行多任务处理。默认情况下,系统有6个字符控制台,可以通过Ctrl+Alt+F2至F6快捷键在它们之间切换。若要返回图形界面,可以按Alt+F1。 pty(pseudo-tty)控制台主要在远程连接或者使用如xshell这样的终端模拟器时发挥作用。当你通过telnet或SSH登录时,会分配到一个pty。此外,用户可以在图形界面下通过Ctrl+Shift+T快捷键创建新的伪终端(pts)窗口,用Alt+数字键在这些终端之间切换,而Alt+F4则用于关闭当前终端。使用`whoami`命令可以查询当前终端对应的身份,这在多用户环境中尤其有用。 Shell是Linux系统的命令行接口,它负责解释并执行用户输入的命令。在RHEL7中,常见的Shell解释器包括Bash(默认)、Sh、Csh和Ksh。Shell有两种执行模式:交互式(Interactive)和批处理(Batch)。交互式模式下,用户每输入一条命令,Shell就会立即执行;而在批处理模式下,用户可以编写包含多条命令的Shell脚本,然后一次性执行整个脚本。 掌握基本的Shell命令是Linux操作的关键,如: - `pwd`:显示当前工作目录,即用户所在的目录路径。 - `cd`:改变当前工作目录,如`cd /home/user`会将当前目录切换到/home/user。 - `ls`:列出目录内容,常用选项如`-l`显示详细信息,`-a`显示所有文件包括隐藏文件。 - `cat`:用于查看和合并文件内容,如`cat filename`显示文件filename的内容。 熟练使用这些命令能够极大地提高Linux系统的操作效率。通过了解和掌握Linux控制台的使用及Shell命令,不仅可以实现对系统的日常管理,还能进行更高级的自动化脚本编程,从而提升工作效率。

为什么会这样[user_mongo@nosql01 replicaset]$ cd /opt [user_mongo@nosql01 opt]$ ll total 0 drwxr-xr-x. 3 root root 25 Mar 16 17:08 servers drwxr-xr-x. 2 root root 51 Mar 16 17:10 software [user_mongo@nosql01 opt]$ tar -zxvf /opt/software/mongodb-linux-x86_64-rhel70-4.4.12.tgz -C /opt/servers/mongodb_demo/replicaset/ mongodb-linux-x86_64-rhel70-4.4.12/LICENSE-Community.txt tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/LICENSE-Community.txt: Cannot open: No such file or directory mongodb-linux-x86_64-rhel70-4.4.12/MPL-2 tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/MPL-2: Cannot open: No such file or directory mongodb-linux-x86_64-rhel70-4.4.12/README tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/README: Cannot open: No such file or directory mongodb-linux-x86_64-rhel70-4.4.12/THIRD-PARTY-NOTICES tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/THIRD-PARTY-NOTICES: Cannot open: No such file or directory mongodb-linux-x86_64-rhel70-4.4.12/bin/install_compass tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/bin/install_compass: Cannot open: No such file or directory mongodb-linux-x86_64-rhel70-4.4.12/bin/mongo tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/bin/mongo: Cannot open: No such file or directory mongodb-linux-x86_64-rhel70-4.4.12/bin/mongod tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/bin/mongod: Cannot open: No such file or directory mongodb-linux-x86_64-rhel70-4.4.12/bin/mongos tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/bin/mongos: Cannot open: No such file or directory tar: Exiting with failure status due to previous errors [user_mongo@nosql01 opt]$ tar -zcvf /opt/software/mongodb-linux-x86_64-rhel70-4.4.12.tgz -C /opt/servers/mongodb_demo/replicaset/ tar: Cowardly refusing to create an empty archive Try `tar --help' or `tar --usage' for more information.

2023-06-01 上传