Basic Commands
Basic Commands
Users
- 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
- To add a user to a group, use:
usermod -a -G <groupname> <username>
To list available groups, run:
getent group
- To check which groups a user belongs to, enter:
groups <username>
- To switch to a different user account, use:
su <username>
- To display the current logged-in username, type:
whoami
- To change a user’s password, use:
passwd <username>
Directories
- 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
- To list all files and directories (including hidden ones), use:
ls -a
- To delete a file, use
rm. Example:
rm test.txt
- To delete a directory and all its contents, use:
rm -rd /home/fivem
Monitoring and Diagnostics Commands
- Check free disk space:
df -h
- Display file contents:
cat <filename>
- Information about RAM usage:
free -m
- Stop a process by its PID:
kill <PID>
- 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).