Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged in a Linux distribution.
License: GPLv2 and others (the name "Linux" is a trademark)
Developer: Community; Linus Torvalds
Initial release date: September 17, 1991
OS family: Unix-like
Written in: C, Assembly language
Default user interfaces: Unix shell, KDE Plasma 5, MATE, Cinnamon, Unity, LXDE, elementary OS, Xfce
What Is A Linux Terminal
The Linux console is a system console internal to the Linux kernel. The Linux console provides a way for the kernel and other processes to send text output to the user, and to receive text input from the user. The user typically enters text with a computer keyboard and reads the output text on a computer monitor.
How to Make a New Directory in Linux
Use the BASH (Bourne-Again SHell) command 'mkdir' to create a new directory in Linux for keeping your files and your hard drive organized. Each directory can have its own parameters attached, such as access, modification and removal permissions. "Mkdir" is one of the more important BASH commands used in Linux; you can use it to make a new directory whenever needed.
Step 1
Check the currently active directory before using the "mkdir" command. This will eliminate errors later if you are using a directory in which you don't have such command privileges. You can check this by using the "pwd" command and pressing "Enter."
Step 2
Type "mkdir [directory]" at the command prompt to make the directory. Use the name of your new directory in place of the [directory] command line operator. For example, to create a directory called "business," type "mkdir business." Be aware that this will create the directory within the current working directory.
Step 3
Use the "-p" command line parameter to create subdirectories within a parent directory. For example, type "mkdir -p games/strategy/chess" to create a directory tree including "strategy/chess" within the "games" directory.
Step 4
Create a new directory in a directory other than the current working directory using the "-p" command line parameter as you did to create a directory tree. In this situation always include the slash "/" before the first directory's name. In other words, if you wanted to create a "chess" directory in a "games" directory that already exists you would type "mkdir -p /games/chess."
Step 5
Make multiple directories at once using the "mkdir" command. Do this by including a space in between each of the directories you intend to create. For example, the command "mkdir -p games bin lib personal" would create "games," "bin," "lib" and "personal" directories all at once.
How To Create User Account
The following command will add a new user called test to your system:
sudo useradd test
What will happen when this command is run will depend on the contents of the configuration file located in /etc/default/useradd.
To view the contents of /etc/default/useradd run the following command:
sudo nano /etc/default/useradd
The configuration file will set a default shell which in Ubuntu is bin/sh. All the other options are commented out.
The commented-out options allow you to set a default home folder, a group, number of days after the password has expired before the account becomes disabled and a default expiry date.
The important thing to glean from the above information is that running the useradd command without any switches may produce different results on different distributions and it is all to do with the settings in the /etc/default/useradd file.
How To Create A User With A Home Directory
The previous example was fairly simple but the user may or may not have been assigned a home directory based on the settings file.
To force the creation of a home directory to use the following command:
useradd -m test
The above command creates a /home/test folder for the user test.
How To Create A User With A Different Home Directory
If you want the user to have a home folder in a different place to the default you can use the -d switch.
sudo useradd -m -d /test test
The above command will create a folder called test for user test under the root folder.
To get this to work without specifying a -m switch edit the file /etc/login.defs and at the bottom of the file add the following line:
CREATE_HOME yes
How To Change A User's Password Using Linux
Now that you have created a user with a home folder you will need to change the user's password.
To set a user's password use the following command:
passwd test
The passwd command will allow you to set the test-user's password. You will be prompted for the password you wish to use.
How To Switch Users
You can test your new user's account by typing the following into a terminal window:
su - test
The above command switches user to the test account and assuming you created a home folder you will be placed in the home folder for that user.
Create A User With An Expiry Date
If you are working in an office and you have a new contractor starting who is going to be at your office for a short period of time then you will want to set an expiry date on his or her user account.
Similarly, if you have family coming to stay then you can create a user account for that family member that expires after he or she has departed.
To set an expiry date when creating a user, use the following command:
useradd -d /home/test -e 2016-02-05 test
The date must be specified in the format YYYY-MM-DD where YYYY is the year, MM is the month number and DD is the day number.
How To Create A User And Assign It To A Group
If you have a new user joining your company then you might want to assign specific groups for that user so that they have access to the same files and folders as other members of their team.
For example, imagine you had a guy called John and he was joining as an accountant.
The following command would add john to the accounts group.
useradd -m john -G accounts
Adjusting Login Defaults Within Linux
The file /etc/login.defs is a configuration file that provides the default behavior for login activities.
There are some key settings in this file. To open the /etc/login.defs file enter the following command:
sudo nano /etc/login.defs
The login.defs file contains the following settings which you might want to change:
PASS_MAX_DAYS: How long before a password expires.
PASS_MIN_DAYS: How often can a password be changed.
PASS_WARN_AGE: Number of days warning before a password expires.
LOGIN_RETRIES: Number of login attempts before failure.
LOGIN_TIMEOUT: How long is it before the login times out.
DEFAULT_HOME: Can a user login if no home folder exists.
How To Specify Login Password Expiry When Creating A User
You can set a password expiry date, the number of login retries, and the timeout when creating a user.
The following example shows how to create a user with a password warning, a maximum number of days before the password expires, and login-retries set.
sudo useradd test5 -m -K PASS_MAX_DAYS=5 -K PASS_WARN_AGE=3 -K LOGIN_RETRIES=1