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系统中的文件管理效率!