美團測開一面準備 --- linux常用指令

cd

cd + 絕對路徑/相對路徑可以跳轉到先對應的文件夾下面

pwd

顯示當前的所在文件夾

man

瞭解指令情況和–help類似

who

關機等指令

ls

ls -l 可以查看文件所有者
ls -alh看什麼整的
顯示當前文件夾下的文件,可以通過ls *.txt正則表達類似的進行查詢

mkdir

創建文件夾

touch

創建文件 touch love{1…10},創建love1到love10的txt文件

find

sudo find 路徑 -name

添加用戶

sudo adduser limei
su -l limei(切換)
exit註銷
groups lilei(看自己屬於哪個用戶組)
cat 讀取內容並打印出來 | sort根據一個字典排序
cat /etc/group |grep -E “shiyanlou”,過濾掉不需要的內容
sudo usermod -G sudo lilei
sudo deluser lilei --remove-home
sudo chown shiyanlou iphone11更改文件擁有者
echo “echo “hello shiyanlou””>iphone11向文件中寫東西
sudo find /etc -name *.list查找以list結尾的文件
chmod 600只能自己讀寫

壓縮和打包的命令

過…

磁盤相對應信息

df 查看磁盤容量

數據的處理

cat test.txt | sed ‘s/hello/nihao’ > test1.txt
echo “hello” | tr -d ‘olh’
echo “hello” | tr -d ‘l’
echo “hello” | tr ‘[a-z]’ ‘[A-Z]’
cat /etc/log | col -x將tab轉化爲空格方便觀察
paste -d ‘:’ file1 file2 file3
paste -s ‘:’ file1 file2 file3合併

crontab語法

過…

正則表達式基礎

sed,grep,awk
+號前面字符出現1-多次
?前面字符出現0-1次
*前面字符出現0-n次
grep -c “shiyanlou” test.txt有幾個
cat test.txt | grep ‘hello’
sed -i 's/hello/nihao test.txt 在原本中替換
sed 's/hello/nihao test.txt >test2輸出到另外一個裏面
sed ‘2d’ passwd刪除第二行

讀寫操作

vi test.txt
esc + :wq退出

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章