Linux文件管理命令非常豐富,以下是一些常用的Linux文件管理命令:
ls
-l(長格式顯示)、-a(顯示所有文件,包括隱藏文件)、-h(人類可讀的文件大?。?。cd
cd /home/user/Documentspwd
mkdir
mkdir new_directoryrmdir
rmdir old_directoryrm
-r(遞歸刪除目錄及其內容)、-f(強制刪除)。cp
cp source.txt destination.txt 或 cp -r source_directory destination_directorymv
mv old_name.txt new_name.txt 或 mv file.txt /new/path/touch
find
find /home/user -name "*.txt"grep
grep "error" logfile.logsed
sed 's/old/new/g' file.txtawk
awk '{print $1}' file.txttar
tar -czvf archive.tar.gz /path/to/directoryzip/unzip
zip archive.zip file1.txt file2.txt 和 unzip archive.zipchmod
chmod 755 script.shchown
chown user:group file.txtdu
-h(人類可讀)、-s(總結)。df
-h(人類可讀)。ps
ps auxtop
lsattr
chattr
chattr +i file.txt(使文件不可修改)scp
scp localfile.txt user@remotehost:/path/to/destinationrsync
rsync -avz /local/path/ user@remotehost:/remote/path/cat
cat file.txthead/tail
head -n 10 file.txt 和 tail -n 10 file.txtcut
sort
uniq
wc
rm -rf)時,請務必小心謹慎。man command)獲取詳細信息。掌握這些基本命令將大大提高你在Linux系統中的文件管理效率!