Skip to main content

Basic Commands

Basic Commands

Users

  1. To add a user, use the command:
adduser <username2>

Then provide a password and confirm it by typing it again. You can skip entering additional user information by pressing ENTER. 2. The user’s home directory will be created under /home. To navigate there, enter:

cd /home
  1. To add a user to a group, use:
usermod -a -G <groupname> <username>

To list available groups, run:

getent group
  1. To check which groups a user belongs to, enter:
groups <username>
  1. To switch to a different user account, use:
su <username>
  1. To display the current logged-in username, type:
whoami
  1. To change a user’s password, use:
passwd <username>

Directories

  1. To create a directory in the current location, use:
mkdir <directory_name>

If you want to create a directory in another location, first navigate there or specify the full path. 2. To display the full path of the current directory, enter:

pwd
  1. To list all files and directories (including hidden ones), use:
ls -a
  1. To delete a file, use rm. Example:
rm test.txt
  1. To delete a directory and all its contents, use:
rm -rd /home/fivem

Monitoring and Diagnostics Commands

  1. Check free disk space:
df -h
  1. Display file contents:
cat <filename>
  1. Information about RAM usage:
free -m
  1. Stop a process by its PID:
kill <PID>
  1. Display active processes:
top

Uwagi

  • When typing a password in the terminal, characters are neither displayed nor replaced by asterisks—this is standard security behavior in Linux systems.
  • Usernames cannot contain special characters (e.g., !@#$%^&*), spaces, or Polish letters (e.g., ąćęłńóśźż).
  • When working with directories, you must either be located in the target directory (cd …) or provide the full path to it in commands (e.g., /home/folder).