Debian文件管理常用命令包括以下几类:
ls -l 显示详细信息,ls -a 显示所有文件(包括隐藏文件)。cd /home/user/Documents 进入指定目录。mkdir new_folder 创建名为new_folder的新目录。rmdir empty_folder 删除名为empty_folder的空目录。rm file.txt 删除文件,rm -r folder 递归删除目录及其内容。cp source.txt destination.txt 复制文件,cp -r source_folder destination_folder 递归复制目录。mv old_name.txt new_name.txt 重命名文件,mv file.txt /new/location/ 移动文件。touch new_file.txt 创建一个空文件。cat file.txt 显示文件内容,more file.txt 或 less file.txt 分页显示。chmod 755 script.sh 设置文件权限为rwxr-xr-x。chown user:group file.txt 将文件所有者更改为user,组更改为group。chgrp new_group file.txt 将文件组更改为new_group。find / -name "config.conf" 在根目录下查找名为config.conf的文件。grep "error" logfile.log 在日志文件中查找包含“error”的行。sed 's/old/new/g' file.txt 将文件中的所有“old”替换为“new”。awk '{print $1}' file.txt 打印文件中每一行的第一个字段。tar -czvf archive.tar.gz /path/to/directory 创建一个压缩归档文件。zip archive.zip file1.txt file2.txt 将两个文件压缩成一个ZIP文件,unzip archive.zip 解压ZIP文件。df -h 以人类可读的格式显示磁盘空间。du -sh /path/to/directory 显示指定目录的总大小。scp local_file.txt user@remote_host:/path/to/destination。rsync -avz /local/path/ user@remote_host:/remote/path/。这些命令构成了Debian系统中文件管理的基础和核心部分,熟练掌握它们将大大提高你的工作效率。