Skip to main content

Basic Linux commands

Linux has a basic impact in our life. However, getting started with Linux just make you discomfort for the first time. Because on Linux, you usually should use terminal commands instead of just clicking the launcher icon (as you did on Windows).But don't worry with experience of more than 3 years as a Developer i feel  Linux is best as using it.We will give you the mostly used linux commands.
So let's get started with the list of 10 Linux Basic commands -

1. sudo ("superuser do") - Allows you to run other commands with administrative privileges. This is useful when, for example, you need to modify files in a directory that your user wouldn't normally have access to.
$ sudo su
2.  ls ("list") - Lists all files and folders in your current working directory. You can also specify paths to other directories if you want to view their contents.
/home$ ls
3. cd ("change directory") - Changes the directory you are currently working in. You can use full paths to folders or simply the name of a folder within the directory you are currently working. Some common uses:
cd / - Takes you to the root directory.
cd .. - Takes you up one directory level.,
cd - - Takes you to the previous directory.
/home $ cd usr
/home/usr $
4. mkdir ("make directory") - Allows you to create a new directory. You can specify where you want the directory created - if you do not do so, it will be created in your current working directory.
~$ mkdir folderName
5. cp ("copy") - Allows you to copy a file. You should specify both the file you want copied and the location you want it copied to - for example, cp foo /home/john would copy the file "foo" to the directory "/home/john".
$ cp src des
6. mv ("move") - Allows you to move files. You can also rename files by moving them to the directory they are currently in, but under a new name. The usage is the same as cp - mv foo /home/john would move the file "foo" to the directory "/home/john".
$ mv src des
7. rm ("remove") - Removes the specified file.
rmdir ("remove directory") - Removes an empty directory.
rm -r ("remove recursively") - Removes a directory along with its content.
$ rm myfile.txt
8. apt-get - This command differs distro-by-distro. In Debian based Linux distributions, to install, remove and upgrade any package we've Advanced Packaging Tool (APT) package manager. The apt-get command will help you installing the software you need to run in your Linux. It is a powerful command-line tool which can perform installation, upgrade, and even removing your software.
$ sudo apt-get update
​In other distributions, such as Fedora, Centos there are different package managers. Fedora used to have yum but now it has dnf. 
9. grep -You need to find a file but you don't remember its exact location or the path. grep will help you to solve this problem. You can use the grep command to help finding the file based on given keywords.
$ sudo apt-get update
10. pwd ("print working directory") - Displays the directory you are currently in.
$ pwd

Conclusion
As I mentioned when I started off the article that these 10 basic Linux commands will not make you a Linux geek immediately. It'll help you to start using Linux at this early stage.So it's all for this article. I hope it helped you. Share with us interesting and useful commands in the comment section below and don't forget to share this article with your friends.

Comments

Popular posts from this blog

Reading and Generating QR codes in Python using QRtools

What are QR codes? A Quick Response (QR) code is a 2 dimensional barcode that is used due to its fast readability and relatively large storage capacity.  2 dimensional barcodes are similar to one dimensional barcodes, but can store more information per unit area. Installation and Dependencies Linux:   qrtools can be installed on debian based linux systems with the following commands $sudo apt-get update $sudo apt-get install python-qrtools The following dependencies must be installed as well [sudo] pip install pypng [sudo] pip install zbar [sudo] pip install pillow Windows:   qrtools can be installed on windows by downloading the file from here(https://pypi.python.org/pypi/qrtools/0.0.1). On downloading and extraction, run the following command from inside the folder python setup.py install Generating a qrCode: qrtools contains a class QR (can be viewed in the source code), for which we must initially create an object. The object takes the ...

MYSQL CONNECTION USING PDO WITH PHP

Hello guys, In the previous tutorial we have seen how to connect to MySQL database with PHP using MySQLi. Today we will learn how to connect with PDO. As a PHP programmer we have learned how to access database by using either MySQL and MySQLi. As of PHP 5.1, there's a better way. PHP Data Objects(PDO) provide methods for prepared statements and working with objects that will make you far more productive! PDO Introduction :        PDO provides a data-access abstraction layer, which means that, regardless of which database you're using, you use the same functions to issue queries and fetch data. PDO does not provide a database abstraction; it doesn't rewrite SQL or emulate missing features. Database Support:       The extension can support any database that a PDO driver has been written for. The following drivers currently implement the PDO interface: PDO_CUBRID Cubrid PDO_DBLIB FreeTDS / Microsoft SQL Server / Sybase PDO_FIREBIRD Firebird PDO_I...