Basic Linux Commands for Hackers | Part 3

Introduction????????

In this post, You will learn some of the important Linux commands. Hope you have seen the other parts.

If you have any doubts watch the video ????????

Video

Let’s start ????

If you have any doubts you can watch the video above or you can ask questions in discord I have given my twitter profile link so you can ask there. ????????

https://discord.gg/uekQW7RQZ8

https://odysee.com/@techyrick:d

https://twitter.com/HacklikeHacker

Viewing Files

In previous part we have see how to open a file using cat command and you can also open a file from different directory.

For example take a look at the below example.

cat /home/rick/here.txt

Taking the head

The head command helps to display the top contents inside a file. Instead of viewing the full file by default the head command shows the top 10 lines in a file.

You can use the head command followed by file name.

head <file name> or head /etc/proxychains4.conf

We can also specify how much line we want to specify.

head -n 20 /etc/proxychains4.conf

Grabbing that tail

To see the last few line in a file we can use the tail command.

tail /etc/proxychains4.conf

To specify how lines to view we can use the -n command.

tail -n 20 /etc/proxychains4.conf

Numbering Lines

To number lines, we can use the nl utility followed by the file name. Here is an example.

nl /etc/proxychains4.conf

Replacing a text in a file

Using the sed command we can replace a text inside a file, Take a look at the below image.

sed s/mysql/MySql/g here.txt
  1. s – search
  2. mysql – the term to search
  3. MySql – Change mysql to MySql
  4. g – replace globally

Controlling the display with more and less

The more command followed by the file name displays more content, Whereas the less command followed by the file name will display less content on the display.

more /etc/proxychains4.conf
less /etc/proxychains4.conf

Conclusion

Hope you learned some new stuff today. Wait for part 3 it will be great. See you guys in the next post ❤️