Sunday, November 29, 2020

Must Know Ubuntu commands for beginners

Hello people! Hope you all are doing good. 

In the previous tutorial, you learned how to create a live bootable USB for ubuntu on windows. Make sure to read that if you want to switch to Linux from windows. If you are a ubuntu beginner and want to learn more about its commands, then this is the perfect post for you.


Ubuntu uses bash as its command-line interface like the command prompt in windows. So let's start with any further due:


1. sudo

sudo means superuser do. This command gives administrative privileges to the user. It is like the "Run as Administrator" command in windows. So if a user would not have access to a specific file and he wants to edit that file, this command should be used.


2. apt-get

This command comes in handy when the user is required to install, update, upgrade, and remove any package. This will save you time as you do not need to do the actions manually. It has some subcommands and let's have a look at them.


a) sudo apt-get update

After the user has installed ubuntu, this is the first command the user needs to run. This will update the database and give info on whether there are new versions of tools available or not.


b) sudo apt-get upgrade

After command a), the user needs to upgrade the installed tools in the database. This command will upgrade all the tools which have newer versions.


NOTE: If the user wants to upgrade any specific tool/ package, then this command should be used. 

sudo apt-get upgrade [PACKAGE NAME]

sudo apt-get upgrade pip


c) sudo apt-get install

Install any package with this command. So before hitting this command, you need to know the package name

sudo apt-get install pip

NOTE: If you don't know the package name properly, just type few letters of the package name and then hit the tab button, it will suggest the names of packages with the letter you have typed. This is like the auto-completion feature.


d) sudo apt-get remove

This command will remove the package but make sure you entered the correct package name. If you don't know the package name properly. 


NOTE: To list down all the packages on your system, use this command:

dpkg --list


Then copy the package name and run the command: sudo apt-get remove the pip

NOTE: The package pip will be removed but its configuration files will still be there. So remove it entirely, use the next command below.


e) sudo apt-get purge

To remove a package completely along with its configuration or data files.

dpkd --list  

Copy the package name and then run the command: sudo apt-get purge pip


f) sudo apt-get autoremove

When a user installs an app/tool, the other dependencies will be installed parallelly. So when you uninstall the app, the dependency will still be there. To remove the unwanted software dependency, use this command. 


NOTE: The user doesn't need to use any package name, as this is a smart command that will automatically remove the unwanted software dependencies that were installed with apps and that are not used by any other app on the system


3. ls 

This command will give the list of all the folders and files of the user's current working directory. 

The user needs to specify the path to the other directories for which they won't see the content.


4. cd

This command comes in handy when the user wants to switch from the current working directory to any other directory. 

cd [FOLDER NAME]

cd Documents


Examples

cd/  - It will take the user to the root directory

cd ..  - It will take up one directory level

cd - -    -It will take to the previous directory

cd documents  - It will switch the current working directory to documents

cd documents\ Blog   -It will open the blog named folder in the documents directory


5. pwd

This will be used to print the full path of the current working directory.


6. cp

Specify the file to be copied and the path to be pasted and you can do the copy-paste job with the command. 

Example: 

cp blog /documents  - This command would copy the blog file and paste it into the documents directory.


7. mv

Move any file to a new location by specifying both the file name and the path.  

mv blog /documents.


8. rm

It will remove the specified file.

Example

rmdir     - It will remove an empty directory

rm -r     - It will remove an empty directory with its content.


9. mkdir

It will create a new directory in your current working dir. To create a dir to a different location, the user needs to specify the directory. 


10. history

This will show the history of the user's previous command up to the history limit.  

Labels:

1 Comments:

At November 30, 2020 at 5:21 AM , Blogger VIKI SINGH said...

More commands will be added soon

 

Post a Comment

Subscribe to Post Comments [Atom]

<< Home