Skip to content

Latest commit

 

History

History
63 lines (35 loc) · 1.72 KB

cheat_sheet.md

File metadata and controls

63 lines (35 loc) · 1.72 KB

Cheat Sheet

Login as root

Change to root when login as any user with root privileged

sudo -i

List all users

cat /etc/passwd

Report file system disk space usage

df -h - will show each first level directory

or

df / -h - will show total

Check Command Path

whereis <command>

or

which <command>

Check Mime Type

file --mime-type -b <filename>

Other packages

Glances

Change file/folder Ownership

sudo chown -R username:group directory

Delete log file

When your /var/log folder become to big, is good to cleanup once a while,

Delete all log

find /var/log -type f -delete

Delete all .gz and rotated file

find /var/log -type f -regex ".*\.gz$"

find /var/log -type f -regex ".*\.[0-9]$"

Reference