github/gitignore · Global/Linux.gitignore

Linux .gitignore 模板详解

说明 Linux.gitignore 忽略编辑器备份(*~)、FUSE 与 NFS 临时文件、KDE .directory、废纸篓目录和 nohup.out 的原因。

在生成器中打开 与 Vim, JetBrains, VisualStudioCode, Go 一起打开

Linux.gitignore 是只有 6 行的简短模板,只处理 Linux 桌面和文件系统生成的副产物。它同样适合放在个人全局 gitignore 中。

每条规则都针对只在特定情况下生成的文件。例如 .nfs* 只出现在 NFS 挂载中,.fuse_hidden* 只出现在 FUSE 文件系统中。

逐条规则详解

模式忽略什么,为什么忽略
*~编辑器备份Emacs、gedit、nano 等保存时留下的 文件名~ 备份。忽略所有名称以波浪号结尾的文件。
.fuse_hidden*.nfs*FUSE 与 NFS 临时文件删除已打开的文件时,文件系统为推迟实际删除而改名保留的文件。进程关闭文件后就会消失。
.directoryKDE 文件夹设置KDE Dolphin 文件管理器保存文件夹显示设置的文件。
.Trash-*废纸篓在可移动介质或其他分区删除文件时生成的按用户区分的废纸篓目录(.Trash-1000)。
nohup.out后台运行日志nohup 运行命令时,输出默认写入的文件。

实践中的注意事项

原始模板

Linux.gitignore规则 6 行
*~# temporary files which can be created if a process still has a handle open of a deleted file.fuse_hidden*# Metadata left by Dolphin file manager, which comes with KDE Plasma.directory# Linux trash folder which might appear on any partition or disk.Trash-*# .nfs files are created when an open file is removed but is still being accessed.nfs*# Log files created by default by the nohup commandnohup.out

模板来源: github/gitignore/Global/Linux.gitignore @356fd7b (2026-09-11) · CC0-1.0

常搭配使用的模板

其他模板详解