TRÄW🤟 Profile picture
Dec 8, 2021 59 tweets 17 min read Read on X
70+ basic Linux🐧 commands explained.

Hey everyone👋! I am finally BACK with another Linux🐧 thread!

In today's thread🧵, I will be going over basics commands every Linux user should know !

A Mega🧵 thread
Have grouped these commands so you can easily Identify their usage.

- Linux Manual/Help Commands
- Linux File Commands
- Linux Directory Commands
- Linux File Content Commands
- Linux User Commands
- Linux Filter Commands
- Linux Utility Commands
- Linux Networking Commands
Pro tip💡: There is no need to memorize all the commands options/arguments, just make use of the help menu or manual pages to find the usage of a specific command/option you want.

continue to read👇
🐧 Linux Manual/Help📑 Commands

1. man
The man command is used to display the user manual of any command that we can run on the terminal.
2. whatis
Whatis command is used to get a one-line manual page description of a command.
🐧 Linux File🧾 Commands

3. cat Command
The cat command is a multi-purpose utility in the Linux system. It can be used to create a file, display content of the file, copy the content of one file to another file, and more.
4. touch
The touch command is used to create empty files and also change file timestamps. We can create multiple empty files by executing them once.
5. rm
The rm command is used to remove a file or files. Be wary when using this command, this command can be dangerous if you don't use it properly.
For more details on the dangers of this command check out this thread.
6. cp
The cp command is used to copy a file(s) or directory(ries) from one location to another.
7. mv
The mv command is used to move/renaming a file(s) or a directory(ries) from one location to another location. A file can be renamed during a move process using the mv command.
This command can be dangerous too if you use it improperly, refer to this if you want to know the dangers.
8. rename
This command is useful for renaming files or a group of files on Linux.
🐧Linux Directory📂 Commands

9. pwd
pwd stands for print working directory. It is used to display the location of the current working directory you are current working in.
10. mkdir
mkdir stands for make directory, this command is used to create directory and subdirectories in any directory.
11. rmdir
rmdir stands for remove directory, it is used to to delete directories
12. rm
This command can also delete folders when used with the combination -rf options.

-f, --force
ignore nonexistent files and arguments, never prompt

-r, -R, --recursive
remove directories and their contents recursively
13. ls
Ls is the most used command in Linux, this command is used to list the contents of directory/subdirectories. The ls has a lot of handy options which I would advise you to check the help or man pages if you want to know more about them.
14. cd
Change Directory (cd) - used to change the current working directory to another directory.
🐧Linux File Content📜 Commands
15. head
This command is used to display the content of a file. It displays the first 10 lines of a file but default, but you can always change it to display first number of lines specified.
16. tail
This command similar to the head command. The difference is that this command displays the last ten lines of the file content by default, but you can always change this behavior if you want. It is useful for reading the error message.
17. tac
tac is the reverse of cat command, you can clearly see that from its name. It displays the file content in reverse order (from the last line).
18. more
The more command is quite similar to the cat command, as it is used to display the file content in the same way that the cat command does. But the main drawback of the cat command is that you can’t control what’s happening after you start it.
The more command displays a text fi le, but stops after it displays each page of data.
19. less
Similar to the more command, the less command is an advanced version of the more command. (the less command name comes from the phrase “less is more”) It also includes some extra features such as 'adjustment in width and height of the terminal.
Refer to this thread if you want to know more about these commands:
🐧Linux User/Group👨‍👨‍👦 Management Commands
20. su
This command allows administrative access to another user. It allows access of the Linux shell of another user. It also run a command with substitute user and group ID.
21. id
command is used to display the effective user ID (UID) and effective group ID (GID).
22. useradd
useradd command is used to add or remove a user on a Linux server
-m - create home directory
-p - new user password
-s - user login shell
xtremepentest - new username
23. adduser
Similar to the useradd command, the adduser is also used to add users on a Linux system. This command provides an interactive way of adding a user unlike the useradd command.
24. usermod
Used to modify a user account i.e changing user home directory, username, enforcing password expiry policies, changing user groups, etc.

Here we are changing the user xtremepentest's password and login shell.
25. chfn
This command is used change real user name and information.
26. finger
user information lookup program. This command displays specified user information. By default it displays the currently logged in user information.
27. groupadd
The groupadd command is used to create a user group.
28. addgroup
Similar to the groupadd command, addgroup is also used to create user groups.
The only difference is that groupadd is usually preferable for scripting (say, if you wan't to create users in batch), whereas addgroup is more user friendly (especially if you are unfamiliar with all the options and flags).
29. groupmod
this command is used to modify a group definition on the system
30. groups
print the all the groups a user is in.
31. users
print the user names of users currently logged in to the current host.
32. who
show who is logged on
33. whoami
print effective userid
🐧Linux Filter/Text📑 Manipulation Commands
34. cut
This command is used to select a specific column of a file. The '-d' option is used as a delimiter, and it can be a space (' '), a slash (/), a hyphen (-), or anything else. And, the '-f' option is used to specify a column number. Example: printing all available usernames
35. grep
grep is the most powerful and used filter in a Linux system. The 'grep' stands for global regular expression print." It is useful for searching the content from a file. Generally, it is used with the pipe.
36. comm
The comm command is used to compare two files or streams. By default, it displays three columns, first displays non-matching items of the first file, second indicates the non-matching item of the second file, and the third column displays the matching items of both files
37. sed
Sed command is also known as stream editor. It is used to edit files using a regular expression. It does not permanently edit files; instead, the edited content remains only on display. It does not affect the actual file. Here is an example of substituting words.
38. gawk/awk
gawk command in Linux is used for pattern scanning and processing language. The awk command requires no compiling and allows the user to use variables, numeric functions, string functions, and logical operators.
39. tee
The command is quite similar to the cat command. The only difference between both filters is that it puts standard input on standard output and also write them into a file.
40. tr
This command is used to translate the file content from lower case to upper case, delete characters.
Here is an example of deleting ":" character
Here is an example of translating characters:
In this example I have translated all ":" to "-".
41. 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.
42. uniq
is used to form a sorted list in which every word will occur only once.
Note💡: 'uniq' does not detect repeated lines unless they are adjacent. You may want to sort the input first, or use 'sort -u' without 'uniq'.
43. sort
command is used to sort files in alphabetical order. It also used in place of the uniq command
44. wc
command is used to count the lines, words, and characters in a file.
45. od
command is used to display the content of a file in different formats, such as hexadecimal, octal, and ASCII characters.
46. nl
Displays line numbers in a file.

• • •

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

Keep Current with TRÄW🤟

TRÄW🤟 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!

PDF

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 @thatstraw

Dec 29, 2023
Linux hand-written notes:🧵 ↓ Image
[2] Image
[3] Image
Read 80 tweets
Oct 24, 2023
13 Linux tr command practical examples you should know as a system administrator: Image
The tr command short for translate, is one of the most useful command for manipulating text on the command line.
It allows you to perform useful operations such as converting lowercase characters to uppercase characters, uppercase characters to lowercase characters, character replacing, and deleting characters.

It is usually used in conjunction with other commands via piping.
Read 29 tweets
Jul 2, 2023
Linux user management - how to add users in Linux 🧵↓
The useradd command is the main tool for adding new users to a Linux system. This command allows you to quickly create a new user account and configure the user's $HOME directory structure.
The useradd command creates a user account by combining system default settings and command-line parameters.

To see the system default values on your Linux distribution, use the useradd command with the -D option:

$ useradd -D
Read 18 tweets
Jul 1, 2023
13 useful Linux find command practical examples 🧵↓
{ 1 } Find empty files and delete them:

This will delete all the empty files in the /home/ubuntu directory.

$ find /home/ubuntu/ -empty -delete
{ 2 } Find big files taking too much space so you can delete them blindly:

This will delete files which are greater than 47000k

$ find /home/ubuntu/ -type f -size +45000k -exec ls -l {} \; | awk '{ print $9 }' | xargs rm -i >/dev/null
Read 17 tweets
Jun 30, 2023
Managing directories in Linux🧵↓ Image
You will regularly need to create and delete directories on the Linux system as a system administrator. The mkdir, rm, and rmdir commands make this possible.
Making Directories🐧

Creating a new directory in Linux is simple; simply use the mkdir command. The mkdir command accepts only one parameter: the name of the directory you want to create

$ mkdir backups Image
Read 18 tweets
Feb 12, 2023
If you want to learn bash scripting and start automating tasks, open this:
1: Intro to Linux Shell Scripting (Free course)

This mini-course is designed to help beginners quickly become proficient in Linux shell scripting in only one hour. It is ideal for those who are just starting with a bash shell.

udemy.com/course/linux-s…
2: Linux shell & scripting tutorial

Another great, free Udemy course to learn shell script core so you can get full potential at the command line.

udemy.com/course/linux-u…
Read 13 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

Don't want to be a Premium member but still want to support us?

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

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(