Files and directories
16 articles, grouped by kind; the order follows the tracks.
Concepts 1
-
Symbolic and hard links
The difference between a symlink and a hard link, when to use which, broken links.
4 minln -sln -sfnreadlink -f
Commands 15
-
Basic file commands
Navigation and files — ls, cd, cp, mv, rm, cat, less, head, tail, terminal copy-paste.
8 minls -lahcd dirpwd -
ls — list directory contents
The ls command lists files and directories with permissions, owner, size and modification time, hidden ones too.
6 minlsls -lls -la -
mkdir — creating directories
Creating directories: -p (with parents), -m (permissions right away), brace expansion, rmdir.
3 minmkdir -pmkdir -mrmdir empty -
stat — file metadata
Full file information — size, permissions, owner, timestamps (atime/mtime/ctime), inode.
4 minstat filestat -cls -lc -
file — determining file type
Figuring out what's inside a file (text, ELF, archive, image) by content, not by extension.
3 minfile ffile -ifile -b -
cp — copy files and directories
The cp command copies files and directories, with overwrite prompts, preserved permissions and times, recursively.
5 mincpcp -rcp -a -
mv — move or rename
The mv command renames a file or directory and moves it elsewhere; it silently replaces an existing target.
5 minmvmv projectmv -i -
rm — remove files and directories
The rm command deletes files and directories at once, with no trash; -i and -I ask first, -r removes a tree.
6 minrmrm -irm -I -
ln — symbolic and hard links
Symlinks (ln -s) and hard links: how they differ, when to use which, common mistakes with relative paths.
4 minln -sln -sfreadlink -f -
Paths — basename, dirname, realpath
Splitting a path into a name and a directory, getting an absolute path; a script's own directory.
3 minbasenamedirnamerealpath -
find — searching for files
Finding files by name, size, time, permissions; acting on what's found.
4 minfind -
tar — archiving and extracting files
Packs files into a compressed archive; an archive with no top directory dumps its files into the current directory.
4 mintar czftar xzftar tvzf -
rsync — file synchronization and copying
Copies only the differences between trees; --delete mirrors the source into the destination, removing anything extra.
4 minrsync -avzPrsync -avznrsync -avz -
restic — deduplicated backups
Incremental encrypted backups with snapshots; without the password the repository cannot be decrypted at all.
4 minrestic initrestic backuprestic snapshots -
git: change history, undo and a remote repository
A version control system: who changed what in the files, how to get back a working version and exchange changes.
15 mingit statusgit diffgit add
Nothing found. Try a shorter query.