Red hat Linux 学习第一篇


第一章
Accessing the command line 访问命令行

目的(Objective):

1.使用 bash 交互环境语法(syntax) 输入命令在Linux
控制台 (console)
2.在GNOME应用程序中开启(launch)desktop 环境
3.使用Bash的特性(特征 feature)根据shell提示使用较少的命令(按键 keystyoke)运行命令

BASH SHELL 交互环境

一个命令行是一个基于文本(text-based)的界面(interface),可以用来输入指令计算机系统

$ common 用户 
# supper 超级用户
su - switch user(选择用户)

虚拟主机(Virtual Console) 

1.用户通过bash交互环境 访问一个终端
2.Ctrl + F1/F7 返回文字界面
3.Ctrl + F2-F6 进入文本界面

Shell 基础 (basic)

命令输入模式(mode)
参数 (options 选项)
如何获取帮助 (文件夹 /usr/share/doc)

1.命令输入模式(mode)
a.必须在shell 指令符 后面 输入命令
b.命令 空格 参数(选项)空格 目标(目的 target)
c.Ctrl + c 结束(返回 cancel )命令

选项(参数 Options)

特殊(specified) 命令 函数(function)
-word 是一个suoxie
--word 是全拼

如何获取帮助?

1.一个参数 --help 能够在命令行获取帮助
-[option] 是 选择性添加
-<option> 是 必须添加
-“...” 是 任意长度
2.如果命令没有 --help 参数 ,可以 使用 “man” 命令
如何使用man 命令?
man + 命令
man 5 + 命令 (系统级)
“/string(字符串)”查找字符串
“q” quit 退出

GNMOE Desktop

怎么登陆?
文本界面 / 图文界面
工作区
切换 (Ctrl + Alt + 上键(uparrow) //Ctrl + Alt + 下键(downarrow) )
打开一个终端
Applications>Utilities>Terminal
锁屏或退出登录
锁:选择(select)用户>lock 或者 ctrl+alt+L
注销 : 选择用户 > log out 
关闭或者重启系统:
关闭:poweroff / shutdown -h now / init 0 / halt (暂停/打断)
重启:reboot / shutdown -r now / init 6 / 

用bash shell 执行命令 !
一个简单命令的例子
Tab 键 的用处
历史命令
编辑命令行

一些简单的命令(date passwd file head tail wc ) 


LAB :

1. 使用student 用户登陆你的 desktop 系统 图形(graphical)屏幕(screen)
2. 打开命令行(终端 Terminal)窗口输入一个bash命令符 (prompt 指令符) 【右键:open in Terminal】
3.更改用户的密码 【passwd 用户名】
4.显示(display)当前的时间和日期 (current 当前) 【date cal(日历)】
5.用 以下(following)形式( 格式 formet)HH:MM:SS A/PM 显示当前时间 【date +%r】
6./usr/bin/clean-binary-files 是什么类型(种类)的文件?? 【file /usr/bin/clean-binary-files】
7.显示 /usr/bin/clean-binary-files 文件的前10行 【head /usr/bin/clean-binary-files】
8.显示 /usr/bin/clean-binary-files 文件的后10行 【tail /usr/bin/clean-binary-files】
{ 如何显示 7-8 行呢 ? 【head -8 file | tail -2 】}
9.怎么 执行(execute) 第44 个历史的命令? 【!44】
10.(execute) 执行 最后一个 包含(contain) “date” 字符命令
【Ctrl + R 输入 date 回车 自动运行 】

That is all
Thank you ! Finn 
各位童鞋晚安 !


以下是英文原版,阿修翻译有不对的地方,欢迎大家留言指错,谢谢咯!

英文原版:
、UNIT 1
Accessing The Command Line
www.westos.orgObjective
User bash shell syntax to enter
commands at linux console
Launch applications in a GNOME
desktop environment
Use Bash feature to run commands for
shell prompt using fewer keystrokes
www.westos.orgThe bash shell
A command line is a text-based interface which can
be used to input instructions to a computer system
GUN Bourne-Again shell (bash)
[kiosk@foundation0 ~]$
– common user
[root@foundation0 ~]#
– supper user
su - username
– Switch user
www.westos.orgVirtual Consoles
Users access the bash shell through a
terminal
Ctrl+Alt+F(1|7)
Ctrl+Alt+F(2~6)
www.westos.orgShell basics
Command input mode
Options
How to get help
www.westos.orgCommand input mode
Input command must at the ending of shell
Prompt
command+[space]+options+[space]+target
ctrl +c
– cancel command
www.westos.orgOptions
specified command function
"-word" is abbreviation
"--word" is full spelling
www.westos.orgHow to get help
one options --help can get help for the
command
– "[options]" is selective add
– "<options>" is must add
– "..." is arbitrary length
if the command don't have --help
please use "man"

how to use command "man"

man + [command]
man 5 + [filename]
"/string" for select
"q" for quit
www.westos.orgGNOME Destktop
How to login


for text
for graphical
Workspace

ctrl+alt+uparrow or ctrl+alt+downarrow
Starting a terminal

Applications>Utilities>Terminal
Locking the screen or logging out
– lock:select [USER]>lock or ctrl+alt+L
– logging out:select [USER]>log out
Powering off or rebooting the system
– powering off [poweroff] [shutdown -h now] [init 0]
– rebooting [reboot] [shutdown -r now] [init 6]

Executing Commands Using the Bash Shell


Examples of simple commands
Tab completion
Command history
Editing the command line
www.westos.orgexamples of simple commands
date
passwd
old_passowrd
new_passowrd
new_password
file

examples of simple commands
head and tail
wc
www.westos.orgTab completion
"<TAB>" can automatic completion of
command ,file name and some

command options

Command history

!number
!string
ctrl +r
Up Arrow
Down Arrow
Left Arrow

Command history

!number
!string
Up Arrow
Down Arrow
Left Arrow
Right Arrow
ctrl + a
ctrl + e
ctrl + u
ctlr + k
ctrl + Left Arrow
ctrl + Right Arrow
ctrl + r

Lab

log into your desktopx system's graphical login screen as
student
open a terminal window that will provide a bash prompt
change student's password to T3st1ngt1me
display the current time and date
display the current time in the following format: HH:MM:SS
A/PM
what kind of file is /usr/bin/clean-binary-files?
use the wc command and bash shortcuts to display the size
of /usr/bin/clean-binary-files
display the first 10 lines of /usr/bin/clean-binary-files
display the last 10 lines at the bottom of the /usr/bin/clean-
binary-files file.
how to execute 44 instructions in history
execute last contains "date" character command
www.westos.org

That's all

举报



欢迎评论,提出观点。 转载请说明出处,谢谢~


如果大家想了解更多请关注微信公众号“IT那些事”(ID: haoyuwl)