Hello there thanks for visiting our site. Today we are going to take a look at 10 very useful Linux command. Some of those Linux commands might end up being a two-for-one deal. Because very often in the world of Linux there is more than one way to skin a cat.
I am writing this article just because I have seen so many people want to know the Linux and Linux command. But they don’t know how to operate it. So this article is for such guys. Also, the people who want to dig a little deeper into the system and learn more about it.
In the modern-day Linux distributions that come with modern desktops have all of the point-and-click tools. That you could possibly ever need to run your system on a daily basis. However, there’s a whole new world that opens up. When you open up the terminal and once you start learning more about what you can do there? You really begin to see the power of Linux. Because with just a few keystrokes. You can do all kinds of amazing things with your computer.
You can see things that are going on in the machine and the more you learn the more you’ll end up opening up that terminal.
I use a lot of these commands on a daily basis. And don’t even think about It. Because they’ve just become part of my computing experience.
So I’m hoping that you guys get something out of this. Some of these are pretty well known and some of them are a little bit lesser-known. So let’s see how this goes.
Linux Command No 1: killall
So basically killall is the very useful command in Linux operating system. If you have an application on the machine that is misbehaving like your web browser locks up and you can’t do anything with it. You just click on the little X or whatever doesn’t close the application.
Also, a lot of times, especially with Firefox the GUI, will close but Firefox has still got crap running in the background you try and open it back up and it says “another Firefox is running” so if you run into this type of situation this is a command that might help you.
killall command tells the system to just kill that program.
So let’s see how to use “killall” Linux command
To use killall command you must have a situation where your running program not getting close.
If you mate such kind of situation use this command in the following order.
[email protected] ~ $ killall “Program Name”
Type-specific name of the Program which you want to close.
Linux Command No 2: touch
Now, this is a really fun command and it does a lot of different things. I’m going to tell you all the things that it does.
The main purpose of the touch command is to create a file in any directory of your computer. It will not just create a single file but you can create multiple files by using this command called “touch“.
When you’re going to do something like creating a document or something like that you might want to start out by creating a file most desktops will allow you to create an empty file by right-clicking.
But if you want to create a whole bunch of files then touch will allow you to do that. So that’s the first thing that touch does it creates files the next thing that touch will do it.
This is really very useful is that if you touch a file that already exists it will create or actually it will modify the time the access time on that file so for whatever reason if you want to just like to open a file and close it very quickly to change the time then you can do it and that becomes very useful when you’re dealing with backup programs.
See how to use “touch” Linux command
[email protected] ~/Junk $ touch “fileName and extension”
For example – [email protected] ~/Junk $ touch file1.txt
To create multiple file using touch command follow following order:
[email protected] ~/Junk $ touch file1.txt file2.txt file3.txt
Linux Command No 3: which
So this is another command and I thought I’ll never use that when I first heard of it. Now I actually use it all the time we’re going to look at the which command. Now the which Linux command tells you where a program is in the computer’s directory.
When you install programs on a Linux machine it places them places the actual executable code in any one of several different directories. So you may end up in a situation where you install a program.
In most of the cases, it will not automatically create a launcher in the menu sometimes that happens so you’re sitting there going. Well did it install?
Is it even here if you know the name of the package you can look for it this way and then you can manually create a launcher in the menu or on the desktop and you’ll not have access to it.
Another reason that you might want to use this command is if you’re writing scripts. While writing scripts the program is going to be in the path statement if it’s going to be running on different machines so therefore you tell it exactly where the program is and in order to be able to do that you’d have to be able to know where it goes.
So how to use “which” Linux command
[email protected] ~/ $ which “Program name”
Here Program name is the program which you installed it on your Linux machine and now you need to see in which directory it store so that you can make changes by going to that directory or folder.
Linux Command No 4: ping
Another really useful command if you run into a situation where your internet just quits working and you open up the browser and it’s not there and or the browser just stops working and you’re trying to figure out what the problem is?
Whether it’s the browser or whether you have connectivity or if you are setting up a machine and you’ve started out just by installing a base system. You don’t have a browser on the machine yet you want to make sure the network is working.
Here’s how you would find out that command is ping command and to run ping we would give it a web page to look for. So, in this case, we’re going to look for google.com you can use any web page you like this.
How to use “ping” Linux command?
[email protected] ~/ $ ping “website address”
For example – [email protected] ~/ $ ping www.google.com
Linux Command No 5: less
So this is also a good command mostly I used related to text reading and configuration files reading also you can be used it if you want to read a long text file.
I know there is another command you might be known is called cat command but it had its own limitation while you’re using it for to read long text files you might be disappointed by using cat Linux command.
So let’s talk about less command this command which is less and actually less is more because this is an update on an older command called More.
If you had a long text file in your directory and you want to read it on your command console you can read it by using this less command in right manner. Once your text file opens on console you will get an options opened it in such a way that I can use the arrow keys and I can scan up and down through all of text one line at a time or can use the Spacebar to Page Down and get down to the bottom I can also use the home and end to move around use those keys and it will respond now when you’re done with your file just click Q and then you’ll get out of it.
How “less” command used in Linux?
[email protected] ~/Junk $ less “fileName”
For example – [email protected] ~/Junk $ less longfile1.txt
Linux Command No 6: sudo blkid
So, guys, this command is little tricky to understand also we needed it on occasion or in a situation that I describing to you in following lines.
Drives that are connected to the system you don’t necessarily see all of the devices that are connected to the system. So if you plug in a USB Drive and it doesn’t automatically mount or for some reason you’re not seeing what happens in your system programs.
Where you can find a hard drive or something like that then you may want to get a list of all of those devices that are on your machine. Also, you may find that you move things around a little bit or you change something and then all of a sudden something is not mounting automatically like your swap partition or something like that.
So you need to find out what the UUID for that is which is the Universal Identifier For a Drive the way the Linux system keeps up with drives is that it issues them an ID and if that drive happens to move around in the system you unplug it from one plug and put it in another plug like with the SATA Drive or something like that it will still be able to find the drive so you need to be able to list those drives so you can find that information if you should have to find out what the UUID is!
find out whether the drive is actually connected to the system so I’m going to use this command called sudo blkid and it lists all the drives on my system and it shows me the UUID for the drives.
See how “sudo blkid” Linux command works
[email protected] ~/Junk $ sudo blkid
Linux Command No 7: sudo
When we issue Linux command as we need administrator privileges. To do that if we’re running in Ubuntu or Linux Mint. A lot of distributions these days we use the sudo Linux command. And that allows us to act as the root user.
In Ubuntu and Ubuntu-based systems, the root account is usually disabled. It’s locked it’s not there you can’t really log in to the root account and act as the root user.
However, there’s a way around this what you can do it is instead of having to issue sudo. After every command, you can kind of emulate being the root user.
How to use “sudo” Linux command?
[email protected] ~/Junk $ sudo -s
If you want to get out of being the root user. You type exit and it puts you back to a normal prompt and you become yourself.
@emachine ~/Junk # exit
Linux Command No 8: su
The “su” Linux command is sort of related to sudo. That it is the ability to switch and become another user. So let’s say that somebody’s on the computer and they’re doing something and they’re logged in is themselves. And you want to log in as you.
You have administrative privileges and for some reason. You’ve got to do something like installing an update or something instead of logging them out then.
Logging yourself back in or using the switch user thing in the GUI. Which takes a time to load you can very quickly become yourself. Even though the computer is logged into another user and you can also become other users to issue commands. So if you want to just jump into somebody else’s account for just a minute. Then you just need to use su command.
How to use “su” Linux command?
[email protected] ~/Junk $ su (another username)
For example – [email protected] ~/Junk $ su michelle
Linux Command No 9: reboot
This is a really useful command and this command is sudo reboot which will do exactly what it says.
If I would hit enter. It would ask for my password to make sure that I had administrator privileges. And then it would restart the system. That is nice if you’re working in a terminal. And you’ve run updates and you want to make sure that everything is the way it should be. You know that there’s a kernel update you can go ahead and reboot the system from that.
See the use of “reboot” Linux command
[email protected] ~/Junk $ sudo reboot
Linux Command No 10: shutdown
One more command that goes along with reboot is the shutdown command.
So with the shutdown command, you also have administrator privileges but it gives you more flexibility. So if I want to shut the Machine down then. I would issue the command this way shut down with an argument H.
Which means I want to halt the system I want it to stop. Actually, other things that you can put here if you put an R there then it will reboot the system. So it does the same thing as sudo reboot but there’s less to type if you just type sudo reboot.
You have to tell the system when you want to do it. So if I would hit this now this computer would go in to shut. It would just shut itself down. But what really makes the shutdown command useful is the fact that. You can give it a time to shut down.
See how to use “shutdown” Linux command
[email protected] ~/Junk $ sudo shutdown -h 15
In this case, your machine will get shut down in 15 minutes.