Shows network connections, routing tables, interface statistics, etc.
ss
Displays socket statistics, faster than netstat.
System Information
Command
Description
uname
Displays information about the system.
lscpu
Shows CPU architecture information.
lsblk
Lists mounted block devices.
5. Linux Basic Commands
Command
Description
ls
Lists the contents of a directory.
cd
Changes the current directory.
pwd
Prints the current working directory path.
mkdir
Creates a new directory.
rmdir
Removes an empty directory.
rm
Removes files or directories.
cp
Copies files or directories.
mv
Moves or renames files or directories.
touch
Creates an empty file or updates the timestamp of an existing file.
echo
Displays a line of text/string that is passed as an argument.
cat
Concatenates and displays the content of files.
more
Displays the contents of a file, one page at a time.
less
Similar to more, but allows backward movement in the file as well as forward movement.
head
Displays the first part of files, defaulting to showing the first 10 lines.
tail
Displays the last part of files, defaulting to showing the last 10 lines.
grep
Searches for patterns in files.
find
Searches for files in a directory hierarchy.
chmod
Changes the file mode (permissions).
chown
Changes the owner of files or directories.
df
Displays disk space usage.
du
Estimates file space usage.
clear
Clears the terminal screen.
exit
Exits the shell or your current session.
history
Displays the command history.
sudo
Executes a command as another user, by default as root.
man
Displays the manual pages for commands.
which
Shows the full path of shell commands.
6. /etc/skel
The /etc/skel directory is the "template" directory on Linux/Unix systems, including Ubuntu. When you create a new user account using tools such as useradd or adduser, the contents of /etc/skel are copied to the new user's home directory (e.g., /home/username). This allows new users to start with some basic configuration files and directory structure.
/etc/skel Directory Purpose
The files and directories inside /etc/skel provide new users with basic configuration files such as .bashrc, .bash_profile, or .profile and sometimes directories such as Documents, Downloads, etc.
These basic configuration files set environment variables, shell behavior, default paths, etc.
System administrators can customize the default environment for new users by modifying the contents of /etc/skel. For example, you can add specific scripts, environment variables, or predefined directory structures.
Common files in /etc/skel
.bashrc: Bash shell configuration file that runs when the user opens a new shell.
.profile: Script run during login session to configure user environment.
.bash_profile: Run on login as an alternative to .profile for bash shell users.
.bash_logout: Script that runs when the user logs out of a shell session.
Utilize /etc/skel
For example, if you want all new users to receive a .bashrc file that customizes their prompt, you can place the .bashrc file in /etc/skel. When you create a new user, this .bashrc file is copied to the home directory, and the user automatically gets a customized prompt.
somaz@/etc/skel$ ls -al
total 20
drwxr-xr-x 2 root root 4096 Apr 21 2022 .
drwxr-xr-x 119 root root 4096 Oct 24 17:25 ..
-rw-r--r-- 1 root root 220 Feb 25 2020 .bash_logout
-rw-r--r-- 1 root root 3771 Feb 25 2020 .bashrc
-rw-r--r-- 1 root root 807 Feb 25 2020 .profile
How to use /etc/skel
Use useradd with the -m option, or when you create a new user using adduser, files and directories in /etc/skel are automatically copied to the new user's home directory.
sudo useradd -m somaz
This command creates a new user somaz and the contents of /etc/skel are copied to /home/somaz.
Unless you use the -m option (or the equivalent in another tool), the user's home directory will not be created, and the contents of /etc/skel will not be copied.
How to apply /etc/skel to an already created user
Sometimes, due to a mistake or not adding the -m option, or an error, the home directory is not created. The solution is as follows: