Introduction
Have you ever felt lost staring at a blinking cursor on a Linux terminal, unsure of what to type next? Are you setting up your first server or simply curious about how Linux works? Well, in this article we will guide you through the basic Linux commands that everyone should know. Learning the basic commands in Linux is like building the foundation of a house, once these basics are in place, you have a strong base to support all your future learning and projects. Whether you're managing a server, automating tasks, or simply exploring Linux for the first time, these commands will be very helpful in expanding your skills and knowledge.
Linux
Linux is an operating system's kernel that was created in 1991 by Linus Torvalds. The kernel in this context means that it facilitates interaction between hardware and software.
Linux is like the brain of your computer. Just as your brain controls everything your body does, Linux controls how your computer's hardware and software work together. It's an operating system like MacOS and Windows, which means it helps you run programs, manage files, and connect to the internet.
What makes it special is that it is open-source, meaning anyone can see how it works, change it, and share it with others. This makes Linux incredibly versatile and secure, and it's used in everything from smartphones to supercomputers. Whether you're browsing the web, running a server, or learning to code, Linux is a powerful tool that helps you get things done.
Ps: Directory is the technical term for a structure in the file system that organizes files and other folders, it is known as a folder. The terminal is where we type our Linux commands.
Basic Commands
The commands you need to run in the terminal will be included with each step as inline code.
1.whoami
- it is a simple command that displays the username of the currently logged-in user.
2.clear
- this is a frequently used command that clears the terminal screen.
3.man
- short form for manual page, it is a built-in and informative manual for using Linux commands. It includes a command description, applicable options, examples, and other sections. man ls
gives information about the ls
command.
4.ls
- this allows us to list out the files and folders present in a directory.ls -l
prints out the list of full information of the files and folders, ls -a
lists out all the files including the hidden ones.
5.pwd
- print working directory, it prints out the path of the current directory.
6.cd
- change directory, this enables us to change the directory from the current one.cd Basic
lets us move into our newly created directory named "Basic" and if we want to get back to where we started we can use cd ..
which moves one level(directory/folder)back, cd ../..
moves us two levels back and so on.
7.mkdir
- short for make directory, allows us to create a folder in our system. mkdir Commands
lets us create a folder named "command" in our current directory.mkdir Commands/Basic
creates a folder named "Basic" inside Command folder.
8.touch
- this command changes file timestamps i.e. touch festo.txt
would change the access and modification time of the "festo.txt" file to the current time. It also creates new files. For instance, touch basic
creates a new empty file named basic.
9.mv
- this command lets you rename your files, let's say we made a mistake typing the name of our file named "journil.txt" and we want to correct it, we use mv journil.txt journal.txt
This changes it to journal.txt.
10.cp
- copy file, we use this to copy files or folders.
11.echo
- The echo command prints out arguments as the output.echo "basic"
prints out - basic on the terminal screen.
12.cat
- short for concatenate, it shows the full contents of a file.cat -n
lets you line or number the contents in the file.
13.history
- this shows us all the commands we ran previously.
14.'rmdir'- Let us to remove or delete a folder.rmdir Commands
deletes the "Commands" folder.
15.rm
- we use this to delete or remove files.
Conclusion
In summary, As you continue your journey with Linux, remember that the Linux terminal is not just a tool, but a gateway to automation, customization, and control. The more comfortable you become with these basic commands, the better equipped you'll be to tackle more advanced tasks and challenges in the Linux environment. Keep exploring, practising, and pushing the boundaries of what you can achieve with Linux.
Credits
(https://youtu.be/ZtqBQ68cfJc?si=Pm4s8_WBMGZmvyzx)
(https://dev.to/clouddiadem/linux-commands-trying-out-linux-commands-with-directories-and-files-5dhh)
Ps: These sites provide useful information that can help us understand Linux commands more effectively.
Top comments (8)
We are all here to learn,try it and let me know how it goes😌
The
touch
command's main purpose is actually to change file timestamps. The fact that it will create a file if it does not exist is merely a convenient side effectThank you so much for pointing that out , I really appreciate and I would work on it
Yeah, thank you for your feedback too
Insightful 💯
Thank you😌