Some basic commands for Linux beginners who switched to Linux from Windows operating system
This article is all about basic commands for Linux beginners who switched to Linux operating system from Windows operating systems and it is also helpful for window users who want to learn Linux. In today’s world, Microsoft Windows is a most useful operating system for personal and commercial usable PCs because of the graphical user interface many of other operating systems are also available on the internet but they either do not contain the graphical user interface or they are not user-friendly. But nowadays many people use Linux for personal and commercial work because Linux has a command-line interface that is easy in use and it is more secure than others. So we use Linux for personal computers and commercial computers.
Now here we will learn about why we use Linux operating system instead of the Windows operating system and we also learn some basic commands which help you to learn the Linux operating system.
1. Run levels on Linux operating system
When you install any version of the Linux operating system on your computer instead of another operating system. It will, by default boot up in the graphical user interface because Linux also has a graphical user interface with the command-line interface. Now you can go on the command line interface simply by pressing Alt+Ctrl+f1 and then enter in your root account by its username and password and then you can saw all the run levels on your Linux operating system by going to the file /etc/inittab This file shows us the all available run levels and the last line tells us about what run level is currently set by default on your system
Run given below command to saw all the run levels on your screen by this command you also can change settings
[[email protected] ~]# vim /etc/inittab
Output for the following command is given below
# Default runlevel. The runlevels used by RHS are: # 0 - halt (Do NOT set initdefault to this) # 1 - Single user mode # 2 - Multiuser, without NFS (The same as 3, if you do not have networking) # 3 - Full multiuser mode # 4 - unused # 5 - X11 # 6 - reboot (Do NOT set initdefault to this) # id:5:initdefault:
Here in this last line id:5:initdefault: is shown the current run level on your operating system in this line you can saw that default level id set to ID:5 which means your system is set to the graphical mode by default because option 5 shows x11 which indicate graphical mode. If you want to change your boot mode from graphical to command mode then simply change the run level by replacing 5 instead of 3 in the above last line like id:3:initdefault and then save this file on your system.
2. How to create users and saw login users on a terminal and also show the all created users on your system
We know that in Linux operating system we have two types of users one is root user which is indicated by the # symbol and another is the general user which is indicated by the $ symbol. Like in windows we called Administrator and local.
To create users and also set passwords for that user in your Linux operating system use this given below command
[[email protected] ~]# useradd rahul [[email protected] ~]# passwd rahul Changing password for user rahul. New UNIX password: BAD PASSWORD: it is too short Retype new UNIX password: passwd: all authentication tokens updated successfully. [[email protected] ~]# useradd satish [[email protected] ~]# passwd satish Changing password for user satish. New UNIX password: BAD PASSWORD: it is based on a dictionary word Retype new UNIX password: passwd: all authentication tokens updated successfully. [[email protected] ~]#
Now to open a new terminal by using the Ctrl+Alt+f2 key and then log in on that terminal from any
of the users which are created by us in the above step. now go on that terminal and use given below
[[email protected] ~]#who i am rahul tty2 2017-01-19 05:18 (192.168.91.1)
Now to check all users and also check on which terminal they are logged in use below-given command
[[email protected] ~]#who rahul tty2 2017-01-19 05:18 root :0 2017-01-19 04:31
Now to remove and change password for any of user use below-given command
[[email protected] ~]# passwd -d rahul Removing password for user rahul. passwd: Success [[email protected] ~]#
Now to saw all the users on your system use below-given command
[[email protected] ~]#cat /etc/passwd
now you can saw that a long list of codes saw on your screen now you saw that in the last
lines in this code your username will be stored example given below
Now to remove a user account from your Linux operating system use below-given command
[[email protected] ~]# userdel rahul [[email protected] ~]# userdel satish
and now you can check that these users will be removed from your system or not by using given
[[email protected] ~]# cat /etc/passwd
Now to show all the files and folders on your system then use given below command and also saw the output of that command
[[email protected] ~]# ls -lh total 60K -rw------- 1 root root 987 Jan 15 02:23 anaconda-ks.cfg drwxr-xr-x 2 root root 4.0K Jan 15 02:30 Desktop -rw-r--r-- 1 root root 29K Jan 15 02:22 install.log -rw-r--r-- 1 root root 3.6K Jan 15 02:21 install.log.syslog
If you have any queries related to any command in the above article then it can be solved through the comment section and in the next tutorial we also can learn about how to create files and folders by different methods in Linux.