Basic Linux Commands - 2
Linux Basic Commands - 2
Hey guys today we are going to take a look at some more Linux commands that you would need in your journey
List of Contents:-
- sudo command
- pwd command
- cp command
- mv command
- history command
Commands and their use cases
1) sudo:-
sudo stands for superuser do
sudo command is used when you want to do something that needs more privilege to do that stuff, it is also called root privilege( Note you only need the root privilege to do certain things if it's needed or you are logged in as another user ---- means if you are logged in as a root user you don't need the root privileges or sudo permissions to do stuff. )
Like if you want to update or upgrade your system or you want to do something in the / directory (We will see Linux system directories in the future blogs) there are so many use cases when you need root permission which you will find when you start getting your hands on Linux.
As you can see in the above example we have tried to update the system without using the sudo command and it gives us some errors and warnings, the thing that the terminal wanted to say here is that ( man you don't have enough permissions so we can't help you here... Then we used the prefix sudo which means ( I am the boss and I am giving you order to update the system ) You are going to need to use the sudo command many times in your Linux journey
2) pwd:-
As the command means print working directory as the name itself suggests that it is going to print the name of the directory you are currently working in.
3) cp:-
The cp command is used to copy something...
The syntax for the cp command is like cp path-of- file/directory path-to-store
As we can see in the above example first we have created a directory named testing then we used the cp command to copy the user.txt file to the folder...
You can also move the entire files to the directory you just have to use the * ( this reference to everything in the directory ) so the example command would be cp * testing/
3) mv:-
3) history:-
As you can see above the history command just simply gives the terminal history.
It's a file that is stored in the user directory as I am using the zsh shell the file is stored with the name of .zsh_history ( you can also notice that it's a hidden file )
Bonus tip:-
Conclusion:-
Stay tuned ✌✌