Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
# Create a hard link ln original.txt hardlink.txt ls -li original.txt hardlink.txt # Same inode number # Create a symbolic link ln -s /etc/nginx/nginx.conf nginx.conf ls -la nginx.conf # lrwxrwxrwx 1 alice alice 22 Apr 10 09:00 nginx.conf -> /etc/nginx/nginx.conf # Remove a symbolic link (not the target) rm nginx.conf # ---- tar archives ---- # Create a .tar.gz archive tar -czvf backup.tar.gz /etc/nginx/ # List contents of an archive tar -tzvf backup.tar.gz # Extract an archive to current directory tar -xzvf backup.tar.gz # Extract to a specific directory tar -xzvf backup.tar.gz -C /tmp/restore/ # Create .tar.bz2 (better compression, slower) tar -cjvf backup.tar.bz2 projects/ # Create .tar.xz (best compression) tar -cJvf backup.tar.xz projects/ # ---- zip ---- zip -r archive.zip projects/ unzip archive.zip -d /tmp/projects_restored/ # ---- disk usage ---- df -h # Free space per filesystem du -sh /var/log/ # Size of a directory du -sh /var/log/* | sort -h # Sorted sizes of subdirectories du -sh /* 2>/dev/null | sort -rh | head -10 # Top 10 biggest root dirs
Result
Open