If you are familiar with system administration, then you have used Linux system once or twice, if not everyday! Actually, these days system administration mainly refers to Linux system management. For this reason, having a good knowledge on Linux system is a must for system administrators. Here is A Must-have List of Linux Commands for Beginners. However, these commands are good for beginners, who are new to system administration. But for an advanced system administrator one should know more commands beyond these.
System Administration Commands
Of course, system administrator’s job area is huge! But, few common things every system administrator do are monitoring processes, terminating processes, checking disk spaces, freeing up disk spaces, viewing log files and many more. For this reason, in this article we will focus on the tools which are used to perform these tasks.
One of the main task of a system administrator is monitoring which process are running in a system. For this reason, there is a command ps. Actually this is one of the most used command. No doubt you can use many parameters with this command. Few examples are:
daredevil78@linux-i36u:~> ps – this will show the running process under current user, with process id.
daredevil78@linux-i36u:~> ps -ef – this will show various useful information. Few of them are User id, Process id, Parent Process id, Processor utilization time, and few more.
daredevil78@linux-i36u:~> ps –forest – this is a very nice command for watching parents and child process.
Actually, as a system administrator there will be many situation when you have to kill one or more running process. In this situation, you can two commands kill and killall.
daredevil78@linux-i36u:~> kill 380 – this command will kill the process with process id 380.
daredevil78@linux-i36u:~> killall http* – this command will kill all the processes starts with http.
Real-time Process Monitoring
Although, ps command show various information about running processes, it is not real-time monitoring. By using ps command we can see the running process for a particular time. For this reason, there is another command, top. This command shows running processes in real time.
daredevil78@linux-i36u:~> top – this command shows also shows running processes, but in real time. It additionally shows priority of a process, virtual memory used by a process, physical memory used by a process and few things more.
No doubt, you will run out of disk space at some point. For this reason, you have to monitor and free up disk space more often. There are two popular commands for this purpose.
daredevil78@linux-i36u:~> df -h – this command shows disk spaces in a human readable format. K for kilobyte, M for megabyte and G for gigabyte.
daredevil78@linux-i36u:~> du -s – this command shows a list of space used by directories and files. It also summarizes each arguments.
Finally, these are the 6 tools you can use in any Linux system. They are per-loaded with every Linux system. Although there are literally hundreds and thousands of Linux command, but mastering these commands will help you to done your job with more ease! So start practicing now!
Definitely, why Virtualization? To begin with, it is a very popular technology now a days. Because it has many advantages over usual physical system. Two most noteworthy advantages are more security and less footprint.
This technology allows segmentation inside a system. As a result, you can run many system in one physical computer simultaneously. In a situation of system crash or virus infection, you can go back to a previous better state using snapshot of your virtual system. This increases security.
At the same time, Virtual system also uses low space and power consumption comparing to real systems.
One practical use of virtual technology you may want to try is installing various operating systems inside your current operating system. To read more about this process read How to install CentOS 7 Linux using virtual technique.
What is Virtualization
Virtualization means using one or more guest operating system inside a host operating system. Further, it allocates system resources for different virtual systems separately. Suppose, you are using a Windows operating system. Now for some reasons you want to use a Linux operating system. In case like this, you can install Linux without using virtual technology. But as a new user of Linux you can use virtualization tools for installing Linux safely, so that it doesn’t crash your entire hard disk.
Virtualization software creates a virtual hard disk, processor, RAM and other necessary hardware correspondingly. After that, your guest operating system will only access those virtually created hardware. So this won’t be able to affect your main operating system.
Popular Tools for Virtual System
There are three main requirements for virtualization.
- Equivalence – Virtual system has to run like a real system.
- Resource control – Host system should have full control.
- Efficiency – Virtual systems have to be able to run any instruction with no or less help of host system.
Why Linux Commands Matter
Linux commands are reason behind the popularity of Linux operating system. Also it’s a operating system which is used in super computers to smart phones. So, having a working knowledge about Linux operating system is a great skill to have. Therefore it’s a mandatory skill for system administrator, network engineers, IT specialist, security analyst, cloud experts and many other types of professionals. So spending your time to learn Linux is actually a long-term investment.
If you haven’t installed Linux in your computer, then you should follow this link. There you will get a elaborated instructions on how to setup Linux in your computer. And after finishing Linux installation part, you are ready to go!
01. Complete offline manual
First Linux command we will see is man. It is a short form of manual. You don’t have to have internet connection or anything else to use this command. If you want to know about any commands, simply type man and then the command. For example, you want to know about the command ls. Then type man ls like below.
[daredevil78@localhost ~]$ man ls
After typing above command, you will get a detailed manual for the command ls. You can scroll through the manual for reading more.
Now suppose you don’t know the command you are looking for, then what you will do? Again you can use man command with -k parameter. -k is the short form of keyword. Suppose you want to see the available commands related to password. Then you can type
[daredevil78@localhost ~]$ man -k password.
This Linux command will show you all the available command related with password.
And if you want to know what man command can do, then type
[daredevil78@localhost ~]$ man man
02. Navigating Around Linux
In Linux system folders are called directory. If you want to move from one directory to another directory, then command is simple. It is cd. cd is the short form of change directory. You have to type cd and directory name.
[daredevil78@localhost ~]$ cd daredevil
If you type the above command, you will go to the directory named daredevil.
Now, if you want to go to one directory up, you have to type
[daredevil78@localhost ~]$ cd ..
If you want to go few directories up, then type
[daredevil78@localhost ~]$ cd ../../
And again, you can type [daredevil78@localhost ~]$ man cd to know about this Linux command in details.
03. Know your current location
Before navigating Linux file system, its better to know your present directory. There is a very useful command for this purpose. pwd, which is a short form of present working directory shows your current directory.
[daredevil78@localhost ~]$ pwd
04. Listing files and directories
After going to desired directory, you may want to see the files or contents of that directory. For that purpose you can use one of the shortest command, ls. ls is the short form of list. This command will list every file and directories of current directory.
[daredevil78@localhost ~]$ ls
There are many parameters you can use with ls commands. Few of them are listed below.
[daredevil78@localhost ~]$ ls -a – shows hidden files and directories.
[daredevil78@localhost ~]$ ls -R – shows files and directories recursively.
Below command will show long listing of directories with many information.
[daredevil78@localhost ~]$ ls -l
If you want information about a particular file or files with same pattern, then enter the commands below.
[daredevil78@localhost ~]$ ls -l file_name – shows information about file_name file.
[daredevil78@localhost ~]$ ls -l my?script – shows information about files matches given pattern.
[daredevil78@localhost ~]$ ls -l my* – shows information about files start with my.
05. Creating Files
In many cases, you have to create new files. For that you can use touch command with file name. If defined file name already exists, then its modification time will be changed.
[daredevil78@localhost ~]$ touch daredevil
06. Copying files
Copying files is one of the most common task you will do frequently. For copying a file the command is cp. cp stands for copy. cp command takes two argument at least. First one is source file and its location. Second command is destination for copied file.
[daredevil78@localhost ~]$ cp old_file new_file
Above Linux command will copy the old_file as new_file.
You can use many parameters with cp command. Some of them are explained below.
[daredevil78@localhost ~]$ cp -i source destination – asks before overwriting at destination.
[daredevil78@localhost ~]$ cp -R source/ destination – copies everything of source to destination.
07. Renaming files
If you want to change a file’s name or move it to a different directory, then mv is your command.
[daredevil78@localhost ~]$ mv fill fall – renames fill file to fall file.
[daredevil78@localhost ~]$ mv Scripts Old_Scripts – renames Scripts directory to Old_Scripts.
08. Deleting files
In Linux system, deleting a file or directory is done by rm command. You can use various parameter with this Linux command.
[daredevil78@localhost ~]$ rm -i fall – removes fall file with confirmation.
[daredevil78@localhost ~]$ rm -ri tamal – descends into tamal dir, removes file, then removes dir.
09. Viewing File’s content
To view a files content without opening it, you can use less command. Though it is called less, but it has many features. All you have to type less and desired file name.
[daredevil78@localhost ~]$ less log.txt
Above command will show you the contents of log.txt file without opening it in any text editor.
The beauty of Linux operating system is you can perform a task in many ways. Above commands are easiest yet powerful. But there are many other Linux commands which you can use to achieve the same output. So, do you know any easy and effective Linux commands except these? Please share with us in comments. Thank you all!
So you have read about Linux? You have heard about it’s awesomeness? And now you want to dive into the Linux world? But don’t know where to begin and how to take the first step? Then Congratulations! You have just found the easiest guide to Linux installation.
For the easiest Linux installation you need few things.
- A Linux ISO image file.
- A CD/DVD or a flash Drive
- [Optional] Virtualization Software
- And obviously a computer.
You can install Linux in your computer in more than one way, like.
- Installing Linux Virtually – Safest and easiest way with little/no limitations.
- Installing Linux Natively – Full blown Linux installation with little risk
- Using Live Linux distribution from Flash Drive – No risk but changes will be gone after restarting your computer.
In this post We will discuss about the first way, which is installing Linux virtually in your computer. Let’s get started!
01. Installing Linux Virtually
For this method you have to download two things. A virtualization software of your choice, I prefer VMware Workstation Player. Then you need an iso image of a Linux distribution of your choice. Again, I prefer CentOS 7. Here is the free download links you need:
VMware Workstation Player: https://www.vmware.com/products/workstation-player/workstation-player-evaluation.html
If you are a Mac OS user, you may need to download Virtual Box, instead of VMware Workstation Player.
Installing VMware Workstation Player
If you have downloaded VMware Workstation Player from the above link, you will get an executable(.exe) file. Double click on that file and follow the installation instruction. You will be able to install this without any complexity.
Preparing a Virtual Machine for Centos 7
Follow the steps below to install CentOS 7 within VMware Workstation Player.
01. Creating a virtual machine: Open VMware Workstation Player and select “Create a New Virtual Machine”.
02. Selecting Operating System: In the next dialogue box, select “I will install the operating system later.”. Then click on “Next >”:
Then select “Linux” and “CentOS 7 64-bit” like the figures below.
04. Naming your virtual machine: Give your virtual machine a suitable name. Also select a folder for your virtual machine files.
05. Allocating resources for your virtual machine: In the next dialogue boxes define hard disk size, ram size, processor numbers.
Click “Finish” when you are done!
06. Selecting Linux iso image: Select newly created virtual machine. Then right click on it for “Settings”. Now select “CD/DVD (IDE)” and browse to where you have copied your CentOS 7 iso image. Select that file and click “OK”.
Installing CentOS 7 in Virtual Machine
Finally, it’s time to power on your virtual computer! Click on “Play Virtual Machine”.
01. Booting new computer from CentOS 7: After turning on virtual machine you will see a boot screen. Select “Install CentOS Linux 7”. Then in the next screen press “Enter”.
02. Selecting language and time zone: In this screen, select language as English. Also select your preferred time zone.
03. Flavor selection: In this step, select “Software Selection”. Then select “Server with GUI”. Finally click on “Done” .
04. Partitioning: This step is very important. Making a mistake in this step may cause your hard disk formatted. Click on “Installation Destination”. After that, select “I will configure partitioning” in the next dialogue box. Then select “Click here to create them automatically”. Then click “Done” and “Accept changes”.
05. Creating root password and another user: Now click on “Begin installation”. In the next screen set a strong root password and create a new user with password. Click on “Done” when finished.
06. Rebooting virtual machine: You can see file copy progress in below and a reboot button when done. Click on that button!
Logging into Linux World
Now you have done installing. Its time to log in to your CentOS 7.
01. Accepting License agreement: When you turn on the virtual computer for the first time, you will see a dialogue box below. Select “License Information”. Then accept the license agreement from below and click on “Done”. Now you can click on “Finish Configuration”.
02. Logging into CentOS 7: Now click on your username, input password and click on “Sign In”.
03. Tour to CentOS 7: After logging in you will see few little “house-keeping” settings. Select next and close the dialogue box.
04. Finalizing the Installation: You can use full screen mode in VMware Workstation player for a larger screen.
Now you have finished your first CentOS 7 installation. Enjoy!
Hope that you are well and enjoying the Linux. Yes, Linux is much more interesting, because, you can customize it as your wish. In this post we’ll see some Linux basic command.
Linux basic command using CLI (more)
Before going to the next part, just remember this small topics.
“ ~ ” >> home directory.
“ / ” >> root partition
“ /root ” >> home directory used by root user
“ /home ” >> user’s home
Now in this post we’ll see some basic and interesting command.
Lets enjoy them.
[ece@localhost Desktop]$ su root
[root@localhost ~]# who
ece :0 2016-05-05 22:17 (:0)
ece pts/0 2016-05-05 22:17 (:0)
[root@localhost ~]# whoami
Command: To show the hostname:
[root@localhost ~]# hostname
Want to see the current date?? Just write date in CLI :
[root@localhost ~]# date
See!! Current date is showing!!
Thu May 5 23:41:00 EDT 2016
Now we’ll see the current date of our machine.
Just type cal. It will show the present month.
[root@localhost ~]# cal
Now if you want to show the calendar of a year, then can type this:
[root@localhost ~]# cal 2017
Want to see the last unsuccessful login?? Here it is.
[root@localhost ~]# lastb
btmp begins Thu May 5 08:42:02 2016
See the run level (5-GUI, 3-CMD, n-none)
[root@localhost ~]# runlevel
Through this command you can see the kernel version:
[root@localhost ~]# uname -r
Want to see the operating system name??
[root@localhost ~]# uname
See the current version from these command.
[root@localhost home]# vi /etc/centos-release
CentOS Linux release 7.2.1511 (Core)
[root@localhost ~]# top
[root@localhost ~]# lastlog
Username Port From Latest
root pts/0 Thu May 5 22:18:46 -0400 2016
bin **Never logged in**
daemon **Never logged in**
[root@localhost ~]# free -m
Mem: 977 522 60 8 395 283
Swap: 511 0 511
[root@localhost ~]# df -HT
tmpfs tmpfs 513M 156k 513M 1% /dev/shm
tmpfs tmpfs 513M 7.5M 506M 2% /run
tmpfs tmpfs 513M 0 513M 0% /sys/fs/cgroup
/dev/sda1 xfs 4.2G 208M 4.0G 5% /boot
tmpfs tmpfs 103M 4.1k 103M 1% /run/user/42
tmpfs tmpfs 103M 8.2k 103M 1% /run/user/1000
/dev/sr0 iso9660 4.4G 4.4G 0 100% /run/media/ece/CentOS 7 x86_64
System uptime info:
[root@localhost ~]# uptime
23:43:23 up 1:26, 2 users, load average: 0.03, 0.04, 0.05
IP address info:
[root@localhost ~]# ip addr
List of previous history:
[root@localhost ~]# history
1 nmcli connection show
Want to change directory??
[root@localhost ~]# cd /
See the list:
[root@localhost /]# ls
Change the directory to the location /var/log:
[root@localhost /]# cd /var/log
Now going back to /var from /log
[root@localhost log]# cd ..
[root@localhost var]# cd –
[root@localhost log]# cd /
[root@localhost /]# cd home
Through the “mkdir” command you can make a directory. Here I’ve created a directory named “test”
[root@localhost home]# mkdir test
Now going to the directory named “test”
[root@localhost home]# cd test
The “pwd” command shows you the present working directory.
[root@localhost test]# pwd
That’s the end of this post. Hope that you have enjoyed. Thanks for visiting here.
Hoping for your return.
Find Us on Facebook
Choose a category !!
- Cisco Certification Exam
- cisco packet tracer 6.2
- Cisco packet tracer 6.3
- Cisco Packet Tracer 7
- Cisco Packet Tracer 7.1
- Cisco Packet Tracer 7.2.1
- Cyber Security
- Engineering Ebooks
- Know computer
- Know your computer
- Laser Processing of Material
- Linux installation and server management