Skip to main content

Quick commands

Change owner of folder

sudo chown -R <linuxuser>:<linuxgroup> <pathtofolder>

Manage Linux groups

Create group

groupadd <groupname>

Add user to group

usermod -a -G <linuxgroupname> <linuxusername>

List groups

sudo groups -la

Managing tar files

Preview content of tar file

tar -tzf <pathtofile.tar>

Extract content of tar file

tar -xzf <pathtofile.tar>

Copy files and folders

cp -r <sourcefolder1/sourcefile1> <sourcefolder2/sourcefile2> <sourcefolder3/sourcefile3> <destinationfolder>

SCP

scp <username>@<sourcehost>:<sourcefile/sourcefolder> <destinationfolder>

Get folder size

du -s <folderpath>

Get task manager view

SAR
TOP

Move foreground job to background

CTRL + Z

bg -> Move job to background
fg -> Move job to foreground

Generate SSH key

ssh-keygen -t rsa -b 4096 -C "<nameforsshkey>" -f .ssh/<nameforsshkey>

Apt remove insecure repositories

sudo apt autoremove

Replace characters in file

sed -i 's/<oldcharacters>/<newcharacters>/g' <filepath>

Sync clock

sudo hwclock -s

Resolve DNS Server

Set dns server on specific interface

sudo systemd-resolve --set-dns=<yourprefereddnsip> --interface=<yourinterface>