List of system related commands:
Show name of system:
uname -a
—
Kernel release information:
uname -r
—
Release os information:
cat /etc/os-release
—
Release all etc information:
cat /etc/*release
—
Check who is currently logged in:
last |grep “logged in”
—
Lists all installed packages:
dpkg –get-selections
—
Save list of all installed packages:
dpkg –get-selections | grep -v install > ~/packages.txt
—
List packages in the system including version, architecture, and description:
dpkg –list
—
Get info about package:
dpkg –info packageName
—
Delete package:
apt-get remove packageName
—
Shows path to current dir:
pwd
—
Change filename:
mv old-file-name.txt new-file-name.txt
—
Delete folder and all of its content:
sudo rm -rf /etc/share/doc
—
List all folders and subfolders and files in dir:
ls -LR
—
List of files in dir + sizes of files:
du -sh *
—
Tar all files in current directory:
tar -czf files.tar.gz *
—
Show which process usess which port:
sudo netstat -peanut
—
Change timezone:
dpkg-reconfigure tzdata
—
Active connections visualisation tool:
mtr 8.8.8.8
(click D for better view)
—
See all processess and their branches:
systemd-cgls
—
See all processes PIDs of a given username:
fuser -m /run/user/username
—
See snapshot of all PIDs of current open processes of username:
ps -u username
—
See snapshot of all current open processes and sort them by most memory usage:
ps aux –sort -rss
—
See all PIDs of current open processes of username:
top -U username
—
Check all info on a current process list:
ps h -ewo %p,%P,%x,%t,%u,%c,%a
Checks: PID, PPID, START_TIME, UP_TIME, USER, COMMANDS, ARGUMENTS
—
Print shell environmental variables:
printenv
—
Print list of all currently opened files:
lsof
—
Print list of currently opened files under a directory:
lsof +D /var/log/