Basic Linux 🐧Commands📜 For Text Manipulation

A thread🧵

Hello everyone👋, Today I'll be doing a quick, easy to follow thread🧵 on basic Linux commands for text manipulation.
#infosec #cybersecurity #Linux
1. Echo🐧
The echo command is used to display line of text to the standard output(stdout).
2. Cat🐧
The cat command is used concatenate files and print their contents on the standard output. In other words it's just used to display the contents of a file.
3. Paste🐧
The paste command is similar to the cat command, it merges lines together in a file and make it a one huge single line.
4. Head🐧
This command is used to display the first part of a file. Let's say we have a very long file and you just wanted to see the first couple of lines in this text file.
Well, this is when the head command comes into play, by default the head command will show you the first 10 lines in a file.
You can also modify the line count to whatever you want, for example let's say I wanted to see the first -3 lines instead. From the picture below the -n stands for the number of lines we want to display.
5. Tail🐧
Similar to the head command, the tail command lets you see the last 10 lines of a file by default. But you can always change it as well and specify the number of lines you want to display. Here I have chose to display the last 3 lines.
6. Rev🐧
This command reverses lines characterwise.
7. Tac🐧
Similar to the cat command, the tac command concatenate and print files contents in reverse order. You can tell from the name that this command is the reverse version of the popular cat command.
8. Sort🐧
The sort command is very useful for sorting files, text lines.
The sort command also has the capability of sorting in reverse order
With sort command you also can sort according to string numerical value.
9. tr (Translate)🐧
The tr (translate) command allows you to translate a set of characters into another set of characters. It's also used to squeeze or delete characters from standard input and display the result to standard output.
On above screenshot we converted all the a -> A, b -> B and c -> C . Note that the number of characters on the first set should be equal to the number of characters on the second set. Let's try another example of translating characters.
Here is another example for deleting characters with tr
The tr command also supports the intimidating 😄regular expressions. Let's try an example of translating all lower case characters to uppercase characters using regex.
10. Uniq (Unique)🐧
The uniq (unique) command is another useful tool for parsing text. It's used to omit/remove duplicates from a file, hence the name uniq.
11. wc🐧
Word Count(wc) is used to print newline, word, and byte counts for each file. It display the number of lines, number of words and number of bytes, respectively.
You can also explicitly specify what you want to display but using the l-, -w, or -c options which will displays number of lines, words, characters(bytes) respectively
let's try out to display the number of lines. Few free to also experiment with other options.
12. nl🐧
Another command you can use to check the count of lines on a file is the nl (number lines) command.
13. grep🐧
The grep command is one of the most common text processing command you will use. It allows you to search files for characters that match a certain pattern.
Grep has a lot of useful switches which I will not discuss😇, but you can also check grep man pages if you want to know more about this handy utility.
14. diff🐧
The diff command simply compares two text sources/text files and outputs their differences. It compares the files line by line to find the differences.
15. Cut🐧
The cut command can be used to remove/extract bytes, characters, and fields from files. Various parameters are used to specify what part or parts of the file are to be removed or displayed.
Here is a quick example, let's say we want to display all the user shells in the /etc/passwd file.
That's it for today's thread! Thank💌 you for reading📚If you liked the thread and found it useful, give me a follow (@xtremepentest) for future Linux, Networking and Security content!. Be sure to also add some commands for text manipulation, would love to know them as well.😇

• • •

Missing some Tweet in this thread? You can try to force a refresh

Keep Current with Traw - Xtreme Pentesting

Traw - Xtreme Pentesting Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!


Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @xtremepentest

16 Nov
OSCP (Offensive Security Certified Professional) Pass and Preparation - Tips and Tricks💡

A thread🧵

#oscp #CyberSecurity #infosec
2. [0x4D31/awesome-oscp: A curated list of awesome OSCP resources (](…)
Read 16 tweets
15 Nov
Abusing SUDO rights and popping r00t shells

A thread🧵
#infosec #CyberSecurity #bugbountytips Image
In this thread🧵, I will be discussing how you can pop a root shell by abusing SUDO rights misconfiguration and will be demonstrating this using this box:…
First things first, let’s start with theoretical concepts!!😄
What is SUDO👑?
Sudo (Superuser Do) - is a Unix and Linux based utility that gives users permissions to run commands at the `root` level (most powerful user).
Read 21 tweets
6 Oct
/A thread🧵👇
There was part one be sure to check it out.

#cybersecurity #infosec #Security

- Corey Schafer (@CoreyMSchafer)- YouTube -
- code with tim python (@TechWithTimm) - YouTube
Read 14 tweets
6 Oct

Do yourself a favour and learn to hack🐞.

You just have to START!🏁, you will be good in no time⏱️.

/ A mega thread🧵👇

Here are a few resources for you to get started.
#cybersecurity #CyberAttack #infosec #hacker
Also, please note that I'm not a professional hacker or pentester. I'm still learning to be, so these are the resources I have found useful along my journey.

1) Basic IT skills.👶🍼
If you are brand new to IT, I strongly recommend this course.
This is a FREE course by Professor Messer –…
Read 24 tweets
18 Aug
#Learn 📚 #Linux🐧:

A thread

Some useful Linux terminal keyboard shortcuts you should know to increase productivity. 👇

#CodeNewbie #coder #computer #code #java #100DaysOfCode #golang #privacy #css #javascript #html #linuxfan #linuxwindows #linuxmint #linuxubuntu #linuxtips
1) Working With Processes📈
Use the following shortcuts⌨️ to manage running🏃 processes.
#linuxfan #linuxwindows #linuxmint #linuxubuntu #linuxtips #linux #programming #hacking #coding #python #cybersecurity #hacker #kalilinux #programmer #technology #coder #100DaysOfCode
2) Controlling the Screen💻
The following shortcuts⌨️ allow you to control what appears on the screen.

#linuxfan #linuxwindows #linuxmint #linuxubuntu #linuxtips #programming #hacking #coding #python #cybersecurity #hacker #kalilinux #programmer #technology #100DaysOfCode
Read 10 tweets
16 Aug
#Learn 🧠🐍#python: Sometimes when programming in python they're situations when you want to copy the contents of an existing list into another. Python has several ways of achieving that. In this thread you will learn different ways of achieving that with the help of examples. Image
1) Using the equal (=) sign operator:
Using = operator you can copy the contents of an existing list onto another/new list. But there's a problem with this method which I will explain on the next section. Image
The problem with the above method is that if you modify the new copied_fruits list the original list (fruits) is modified too, this is because the copied list (copied_fruits) is referencing/ pointing to same fruits list in memory.
Read 17 tweets

Did Thread Reader help you today?

Support us! We are indie developers!

This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Thank you for your support!

Follow Us on Twitter!