1. 程式人生 > >小白的linux學習之旅(一)

小白的linux學習之旅(一)

探索linux

一、進入系統

*)普通用戶登陸

student 普通用戶,密碼student

*)超級用戶登陸

—〉not listed 點擊未列出

username 提示輸入用戶名稱

—〉root root 為系統超級用戶

passwd 提示輸入密碼

—〉redhat redhat超級用戶密碼

技術分享

1、行提示符
[[email protected] Desktop]$

kiosk 打開shell的用戶

@ 分隔符

foundation0 主機名稱

Desktop 工作目錄名稱

$ 身份提示符,#表示超級用戶,$表示普通用戶

2、切換用戶

[[email protected] Desktop]$ su - username

*)高級用戶切換到低級用戶不需要密碼,低級用戶切換到高級或著平級用戶的切換需要密碼。

3、虛擬控制臺

Ctrl+Alt+F(1|7) 進入圖形
Ctrl+Alt+F(2~6) 進入虛擬控制臺

4、命令的執行

1)、命令必須在行提示符之後輸入

2)、命令格式
命令 參數 目標

3)、ctrl +c 撤銷命名的執行

4)、命令參數

-參數 單詞縮寫
--參數 單詞的全拼

5、命令的幫助

whatis 命令 查看命令的功能

命令 --help 查看命令的幫助

[ ] 選擇加入的內容,可加可不加
... 加入的內容個數任意

<> 內容在命令執行過程當中必須要加

6、系統的使用基礎方法

1)、系統登陸

圖形登陸方式
文本登陸方式
gnome-session-quit --force 註銷用戶 --force強制註銷,不詢問

2)、工作界面轉換

ctrl+alt+上|下

3 )、開始bash

Applications>Utilities>Terminal

鼠標右鍵----->open in terminal

gnome-terminal
ctrl+shift+n 在新窗口中打開shell

ctrl+shift+t 同一個窗口中打開新的tab

退出: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 修改用戶密碼
[[email protected] ~]# passwd

技術分享

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)、c統計文件容量信息
wc -l 行數
-w 字數
-c 字節數
-m 字符數

技術分享

三、tab鍵

在系統中table鍵可以自動補齊存在的命令,文件名稱和某些命令的參數

a+TAB x2 顯示系統中所有a開有的命令。

技術分享

四、history歷史調用

history 顯示歷史
hostory -c 清除當前環境當中的歷史命令
!數字 執行第多少行命令
!字母 執行最近一條以這個字母開頭的命令
ctrl +R +關鍵字 執行最近一條含有這個關鍵字的命令
上下鍵 逐行調用命令

技術分享

五、linux中的快捷鍵

左右 一個字符一個字符移動
ctrl +左右 一個字一個字移動
ctrl + a 光標移動到行首
+ e 光標移動到行尾
+ u 光標所在位置刪除到行首
+ k 光標所在位置刪除到行尾
+ r+關鍵字 調出最近一條含有關鍵字的命令
+ c 撤銷以輸入的命令
+ d 關閉當前環境
+ L 清空屏幕
+ shift + c 復制
+ shift + v 粘貼
+ shift + t 在現有shell中重新打開一個table
+ shift + n 在shell中打開一個新的shell
+ shift + pageup|pagedown 切換table
+ alt + l 鎖屏
+ alt +上|下 切換工作界面
+ alt + f1|f7 進入圖形界面
+ alt + f2-f6 進入虛擬控制臺








小白的linux學習之旅(一)