Management commands

General

su → Opens a root shell

adduser NameOfUser → Add a new user

useradd NameOfUser → Another way to add a new user

adduser NameOfUser sudo → Add user to sudo-group

echo "username ALL=(ALL) ALL" >> /etc/sudoers → On some machines we might not be able to Edit the sudoers file because we don't have an interactive shell, in this case we can just redirect the text into the file

cat /etc/group | grep sudo → Check which users are in the sudo group

su NameOfUser → Switch user in terminal

sudo userdel NameOfUser → Remove/delete user

Permissions

ls -la → Show all the files and directories and their permission settings

chmod +x → Give executable permissions to all users

chmod -x → Remove executable permissions to all users

chmod 777 file → Give read, write and execute permissions to all users on that file

sudo chown myfile → Give ownership of myfile to all users

passwd → Change password of current user

sudo chmod u+s myfile → Modify SUID permissions to grant read, write and execyte to all users

Processes

ps → list all running processes

ps aux → Displays a detailed list of all processes running that don't have TTY associated with.

top → monitor processes at real time

kill PID-number → Kill process running on the PID number

kill -9 PID-number → Another way to kill the process

ls /proc → List process information stored in the filesystem

Last updated

Was this helpful?