linux菜鳥基礎學習(一)
1.虛擬機的控制
虛擬機是在真機上建立的,為何要建立虛擬機,主要是防止由於錯誤操作導致不可挽回的結果。
[kiosk@foundation0 Desktop]$ rht-vmctl start desktop ###開啟desktop虛擬機
Error: desktop not started (is already running) ###報錯,desktop已經運行
[kiosk@foundation0 Desktop]$ rht-vmctl view desktop ###顯示desktop
[kiosk@foundation0 Desktop]$ rht-vmctl poweroff desktop ###關閉dekstop
[kiosk@foundation0 Desktop]$ rht-vmctl start desktop ###開啟desktop
Starting desktop.
[kiosk@foundation0 Desktop]$ rht-vmctl view desktop
[kiosk@foundation0 Desktop]$ rht-vmctl poweroff desktop
Powering off desktop..
[kiosk@foundation0 Desktop]$ rht-vmctl view desktop
Error: unable to view desktop - not currently running. ###虛擬機沒開啟無法顯示
Are you sure you want to reset desktop? (y/n) y ###詢問是否重置y表示yes
Resetting desktop. ##正在重置
Powering off desktop..
2.進入系統
3.*)普通用戶登陸
student 普通用戶,密碼student
*)超級用戶登陸
->not listed 點擊未列出
->root root為系統超級用戶
passwd 提示輸入密碼
->redhat redhat是超級用戶密碼
3.語言的調整
Applications ----->system tools---->settings ----->Region & language --->language
打開命令行---> reboot
系統命令和快捷鍵的了解
1.行提示符
[kiosk@foundation0 Desktop]$
kiosk ##打開shell的用戶
@ ##分隔符
foundation0 ##主機名稱
Desktop ##工作目錄名稱
$ ##身份提示符,#表示超級用戶,$表示普通用戶
註意:命令要在行提示符之後輸入才能執行
2.切換用戶
[kiosk@foundation0 Desktop]$ su - username
*)高級用戶切換到低級用戶不需要密碼,低級用戶切換到高級或者平級用戶的切換需要密碼
3.虛擬控制臺
Ctrl+Alt+F(1|7) 進入圖形
Ctrl+Alt+F(2~6) 進入虛擬控制臺
Red hat Enterprise Linux Server 7.0 (Maipo) ##系統版本
Kernel 3.10.0-123.el7.x86_64 on an x86_64 ##內核版本,系統位數
desktop0 login:root ##登陸用戶名稱輸入
Password: ##密碼輸入無回顯
4.命令的執行
1.命令必須在行提示符之後輸入
2.命令格式
命令 參數 目標
3.ctrl +c ##撤銷命名的執行
4.命令參數
-參數 ##單詞縮寫
--參數 ##單詞的全拼
5.命令的幫助
whatis 命令 ##查看命令的功能
命令 --help ##查看命令的幫助
[] ##選擇加入的內容,可加可不加
... ##加入的內容個數任意
<> ##內容在命令執行過程當中必須要加
6.系統的使用基礎方法
1)系統登陸
圖形登陸方式
文本登陸方式
gnome-session-quit --force ###註銷用戶 --force強制註銷,不詢問
2)工作界面轉換
ctrl+alt+上|下
3)開始bash
1.Applications>Utilities>Terminal
2.鼠標右鍵----->open in terminal
3.gnome-terminal
4.ctrl+shift+n ##在新窗口中打開shell
ctrl+shift+t ##同一個窗口中打開新的tab
5.退出:exit | ctrl+d
4)系統關機,重啟
重啟
reboot | init 6 |shutdown -r now
關機
poweroff | init 0 | shutdown -h now
5)鎖屏
ctrl + alt +L ##在rhel7.0
win鍵 + L ##在rhel7.2
簡單的系統命令
1) date
watch -n 1 date ###讓date命令每秒執行一次,ctrl +c 推出監控模式
date 11181115 ###把系統時間設定為11月18日11:15 格式:月月天天小時分鐘
date 111811152016.55 ##2016表示年(可以不加).55 表示秒(可以不加)
-d +xday -xday ##查看x天前或者後的時間
+%.... ##設定date的輸出格式
2)passwd
1.passwd 修改用戶密碼
[root@foundation0 ~]# passwd
Changing password for user root. ##改變超級用戶密碼
New password: ##輸入密碼
BAD PASSWORD: The password is shorter than 8 characters
Retype new password: ##確認密碼
passwd: all authentication tokens updated successfully.
[kiosk@foundation0 Desktop]$ passwd
Changing password for user kiosk. ##改變普通用戶密碼
Changing password for kiosk.
(current) UNIX password: ##輸入當前密碼
New password:
BAD PASSWORD: The password is the same as the old one ##和原始密碼不能相似
New password:
BAD PASSWORD: The password fails the dictionary check - it is too simplistic/systematic ##密碼必須是無序數字+字母
New password:
BAD PASSWORD: The password is shorter than 8 characters ##密碼必須>8位
passwd 參數 用戶名稱
-S student ##用戶密碼信息
--status student 。。。。。。
-l student ##鎖定帳號
-u student ##解鎖
-n 1 student ##設定密碼最短有效期
-x 30 student ##設定密碼最長有效期
-w 3 student ##警告期,即密碼還有多久失效
-i 2 student ##設定用戶非活躍天數
##即用戶密碼失效後,用戶沒有立即註銷,非活躍天數就是失效後註銷前的天數
-d student ##清除用戶密碼
監控passwd密碼信息
watch -n 1 passwd -S student
3)file
file 文件名字 ##查看文件類型
4)文件的查看
cat filename ##顯示文件的全部內容
less file ##分頁瀏覽,按“q”退出
head filename ##顯示一個文件的前幾行
head -n 5 filename ##前五行
tail filename ##顯示文件後幾行
tail -n 5 filename ##顯示一個文件的後5行
5)wc統計文件容量信息
wc -l 行數
-w 字數
-c 字節數
-m 字符數
tab鍵
在系統中table鍵可以自動補齊存在的命令,文件名稱和某些命令的參數
a+TAB x2 顯示系統中所有a開有的命令
history歷史調用
history ##顯示歷史
hostory -c ##清除當前環境當中的歷史命令
!數字 ##執行第多少行命令
!字母 ##執行最近一條以這個字母開頭的命令
linux中的快捷鍵
左右 ##一個字符一個字符移動
ctrl +左右 ##一個字一個字移動
ctrl + a ##光標移動到行首
- e ##光標移動到行尾
- u ##光標所在位置刪除到行首
- k ##光標所在位置刪除到行尾
- r+關鍵字 ##調出最近一條含有關鍵字的命令
- c ##撤銷以輸入的命令
- d ##關閉當前環境
- L ##清空屏幕
- shift + c ##復制
- shift + v ##粘貼
- shift + t ##在現有shell中重新打開一個table
- shift + n ##在shell中打
- alt + l ## 鎖屏
- alt +上|下 ##切換工作界面
- alt + f1|f7 ##進入圖形界面
- alt + f2-f6 ##進入虛擬控制臺
linux菜鳥基礎學習(一)