Raspberry Pi

Top 10 Basic Commands of Raspberry Pi OS

Since the Raspberry Pi operating system is Linux based, working on Raspberry Pi can be a difficult task if you don’t have any idea about the commands used in the terminal. If you are a beginner, you probably don’t have any specific idea about so many commands which are too basic and easy for most people.

You are already familiar with the Windows operating system where you can access the files, viewing the folders or copying and pasting the documents in another folder. This looks quite easy for everyone but if you are working on Raspberry Pi, you will get a much more simple solution by having full control of your desktop through the terminal and you don’t need to go into each folder and make changes into the files.

10 Basic commands of Raspberry Pi

Here is the list of 10 basic commands of Raspberry Pi that will help save your time in searching for these basic commands. You have to remember those commands and it will help you in future.

1. Updating and Upgrading your Raspberry Pi

After installing your Raspberry Pi operating system, it is necessary for you to get updates about your software packages so that you are able to upgrade them in order to enjoy the latest version software on your Raspberry Pi operating system. If you are interested in downloading the latest update of your packages, you need to run the below command in the terminal.

$ sudo apt-get update

The above command will provide you the latest updates for your software and packages. Now, after getting the required updates, you need to upgrade your software using the below mentioned command, which will successfully upgrade the required packages for your system.

$ sudo apt-get upgrade

If your packages are already upgraded, you will get the output below which shows that you don’t need to upgrade.

2. Changing your Raspberry Pi password

The Raspberry Pi operating system has come up with the default password. Sticking with the default password might not be good enough for your system security. You can change your password successfully by entering the below mentioned command in the terminal.

$ passed

When you type in the above command, it will ask you to enter your current password and you have to type the default password in it and then press Enter. Next, you will need to type your new password and press enter.

3. Finding the location of the installed program

If you are having difficulty finding the location of your installed program, you need to use the “whereis [name of the file]” command in the terminal. Suppose you are finding the location of the VLC media player on your Raspberry Pi operating system so you need to type the below command.

$ whereis vlc

Using the above command to find the location of your program and you can move towards the location in no time.

4. Listing the Current Directory’s Content

In Raspberry Pi terminal, if you use the command “ls” you can list the content of the current directory. The below image will show the content of the current directory when we enter the “ls” command in the terminal.

$ ls

5. Changing Directories

If you wish to change your current working directory there is a command called “cd” or “change directory”. If you type “cd /usr/lib” or any directory path and press enter, it will move you to the “/usr/lib” directory and if you want to see the list of contents of the directory:

$ cd
$ cd /usr/lib

You can simply use “ls” next and then press enter to see the content on your terminal.

6. Configuring Raspberry Pi

In case if you want to configure the settings of your Raspberry Pi, you can use the command “risp-config” command in the terminal to open up the configuration of your Raspberry Pi.

$ sudo raspi-config

After entering the above command, you will see the configuration of your Raspberry Pi and you can change anything from it if you want.

7. Copying Files on Raspberry Pi

If you want to create a copy of your file in the same directory you can use the “cp” command to do it. If you type “cp [Original File Name] [Copied File Name]“ in the terminal you will get a new file in the same directory where the original file is placed.

$ ls
$ cp New1.txt New2.txt
$ ls

8. Renaming your File on Raspberry Pi

If you wish to rename your file on Raspberry Pi OS, you can do it with the help of “mv” command. If you type “mv [Original File Name] [Renamed File Name]” in the terminal you will get the rename file in your current directory.

$ ls
$ mv New1.txt New2.txt
$ ls

9. Shutting Down Raspberry Pi

If you are interested in shutting down your Raspberry Pi from the terminal, you need to type the below command to shut down the Raspberry Pi.

$ sudo shutdown -r 10

The above command in the terminal requires root access to shutdown the Raspberry Pi that is why “sudo” is used while “-r 10” means that the system will shut down after 10 minutes. If you replace “-r 10” with “now” it will shut down immediately.

10. apt-get Command

The apt-get command is a widely used command on Raspberry Pi terminal as it  will help you to find the required packages to install any software on your Raspberry Pi system.

There are two methods to use apt, the first is to use the command “sudo apt install [software name]” and the other is “sudo apt-get install [software name]”. Both commands work similar in most cases but if sometimes “apt” is unable to find a software package then apt-get will help in that case.

Suppose, you are trying to install a software “kodi” on your Raspberry Pi desktop so for this purpose you need to type any command from the below two apt and apt-get commands in the terminal to install the “kodi” on Raspberry Pi.

$ sudo apt install kodi

$ sudo apt-get install kodi

As from the above image, you can see that both commands will install the “Kodi” software for you so you can select any command.

Apt command is also used to remove the software packages as well. For that you will need to write the below mentioned commands if you remove any software from the Raspberry Pi OS. In our case as we are removing “kodi”, the commands will look like below.

$ sudo apt remove kodi

You can use the below command as well if you want to remove a software from your Raspberry Pi as mentioned below. To remove other software, you will need to replace “kodi” with the name of the other software.

$ sudo apt-get remove kodi

Conclusion

Learning becomes easy if you are provided with enough guidelines. If you have recently started to use  Raspberry Pi OS, you will love to try these commands on your Raspberry Pi terminal. These are the basic commands and most of the time you will need these commands while working on the Raspberry Pi.

About the author

Awais Khan

I'm an Engineer and an academic researcher by profession. My interest for Raspberry Pi, embedded systems and blogging has brought me here to share my knowledge with others.