Linux is a very popular and interesting operating system (OS), especially for programmers. The Linux terminal is a very important part of a Linux OS. That means that if you know the basic commands to enter the terminal, you'll be more comfortable and confident in using this OS.
There is so much information about Linux and so many courses. But almost no one can give you a shortlist of the most popular and useful commands except for the already well-known ones like
cd. I use some of these commands myself, and I can't imagine the programmer's life without them.
Touch is one of the easiest commands that will help you to create a new empty file (you can also create a bunch of files) in the directory that you're currently in.
If you have a slow PC or just want to kill all running processes that are interfering with your work, use this command:
But you should remember that it deletes any data and won't let any application save it. By default, the killall command is case-sensitive. But you can use the -I option to ignore the case.
killall -I notes
Using the traffic control command, you can manipulate network traffic inside your Linux OS. A common example where
tc is used is in applying some packet delay to a network connection. With
tc you can manipulate incoming and outgoing packets to apply things like delay or even drop a certain number of them entirely. Let's take a look at a relatively simple example where we apply a delay to our own network connection. That's my ping at Google:
[email protected]:~ $ ping 188.8.131.52 PING 184.108.40.206 (220.127.116.11) 56(84) bytes of data. 64 bytes from 18.104.22.168: icmp_seq=1 ttl=117 time=13.6 ms 64 bytes from 22.214.171.124: icmp_seq=2 ttl=117 time=10.9 ms 64 bytes from 126.96.36.199: icmp_seq=3 ttl=117 time=15.5 ms 64 bytes from 188.8.131.52: icmp_seq=4 ttl=117 time=13.8 ms
Let's induce 100ms of delay with
sudo tc qdisc add dev eth0 root netem delay [email protected]:~ $ ping 184.108.40.206 PING 220.127.116.11 (18.104.22.168) 56(84) bytes of data. 64 bytes from 22.214.171.124: icmp_seq=1 ttl=117 time=110 ms 64 bytes from 126.96.36.199: icmp_seq=2 ttl=117 time=116 ms 64 bytes from 188.8.131.52: icmp_seq=3 ttl=117 time=119 ms 64 bytes from 184.108.40.206: icmp_seq=4 ttl=117 time=113 ms
Suppose you want to edit a really long command that you just fired. Using the terminal will need some effort. The
fc command solves this problem.
In the below example, I ran a
curl command that had a typo. So I ran the
fc command. The previous command,
curl , opened in an editor; I fixed the command and saved the file. And the
curl command ran again with the results.
whiptail is the command that creates a wonderful pop-up message. This is a handy single-purpose utility for displaying dialog boxes right inside of the terminal.
whiptail --yesno "Did you already know whiptail?" 40 150
whiptailhas a wide range of different displays and inputs for you to choose from:
uname gets the Linux version-related information about the operating system we're currently using. You can use
-n so that the terminal shows you exactly what you were looking for.
How do you usually delete files? Do you use
rm? If there was any sensitive data in that file, you may want to think twice about using
rm for that sort of thing. This is where
shred comes in. This little utility will actually erase a file securely by writing random data over top of the file multiple times.
shred -u file.txt
ps displays information about a selection of the active processes.
echo displays a line of text or whatever you want in your terminal (just like a print function).
echo -e "Geeks \vfor \vGeeks"
sl is one of the funniest commands, which is why I saved it for last.
brew install sl
You'll get something like this:
sl -F and see it fly.
Thanks for reading my article. Linux has a lot of different commands. However, I tried to find the ten best and most handy ones that will make you a pro at using the OS. Hope these commands will make using the OS a more pleasant experience for you.
Источник: dev.tolinux programming cybersecurity beginners