Linux Commands

    *   date - display or set the system date and time

        date

 

    *   uname - display system informatio

        uname

        uname –a(all)

        uname –r(recursive/ পুনরাবৃত্তি)

 

    *   whoami - display the current user name

        whoami

 

    *   pwd - print the current working directory

        pwd

 

    *    sudo - execute a command as another user or with elevated privileges

        sudo

 

    *   su - switch user to become another user

        su <user>

 

    *   cd - change the current directory

        cd <dir_name>

 

    *   cd .. – back to the directory

        cd ..

 

    *   ls - list the files and directories in the current directory

        ls

 

    *   touch - create a new empty file or update the timestamp of an existing file

        touch shayan.txt

 

    *   mkdir - create a new directory

        mkdir <file name>

 

    *   cp - copy files or directories

Ø #We will copy a file called example.txt from the current directory to a directory called backup

 

        cp example.txt backup/

 

    *   mv - move or rename files or directories

        mv example.txt backup/

 

    *   rm - remove file

        rm example.txt

 

    *   rmdir - remove directories

        rm <dir name>

 

    *   man - manual for a command

        man ls

 

    *   nano - concatenate and display files

        nano example.txt

 

    *   cat - concatenate and display files

        cat example.txt

 

    *   htop - an interactive process viewer and system monitor

        htop

 

    *   tar - create or extract compressed archive files

Ø # x: extract files from an archive

Ø # t: list the contents of an archive

Ø # r: append files to an existing archive

Ø # z: use gzip compression

Ø # j: use bzip2 compression

Ø # cf: create file

Ø # xf: extract file

 

        tar cf archive.tar file

 

    *   gzip - compress files

        gzip file.txt

 

    *   gunzip - decompress compressed files

        gunzip file.txt.gz

 

    *   ping - test network connectivity

        ping 8.8.8.8

 

    *   ifconfig - display or configure network interfaces

        ifconfig

 

    *   netstat - display network connection information

        netstat

 

    *   route - view or configure network routing tables

        route [options] [add/delete/show]

 

    *   top - display system resource usage and processes

        top

 

    *   ps - display information about running processes

        ps aux

 

    *   kill - terminate a process

        kill [PID]

 

    *   systemctl - control system services and settings

Ø # Start the nginx service

        systemctl start nginx

 

Ø # Check the status of the nginx service

        systemctl status nginx

 

Ø # Stop the nginx service

        systemctl stop nginx

 

    *   service - control system services

        service apache2 start

 

    *   useradd - add a new user to the system

        useradd MR

 

    *   passwd - change the password for a user

        passwd MR

 

    *   userdel - delete a user from the system

        userdel MR

 

    *   which - locate a program or command in the system path

        which ls

 

    *   finger - displays all the information about user

        finger harry

 

    *   chmod - change the permissions of a file or directory

Ø # The first digit represents the owner of the file/directory

Ø # The second digit represents the group that the file/directory belongs to

Ø # Admin(rwx), Group(rw), Public(r)

Ø # The third digit represents all other users

Ø # 0 (no permission)

Ø # 1 (execute only)

Ø # 2 (write only)

Ø # 4 (read only)

 

        chmod <permission number> file.txt

 

    *     chown - change the owner of a file or directory

        chown new_owner example.txt

 

    *   ssh - connect to a remote server securely

        ssh username@server_address

 

    *   scp - securely copy files between systems

        scp myfile.txt user@remotehost:/home/user/

 

 

 

    *   history - display a list of previously executed commands

        history

 

    *   locate - locate any file on the system

        locate file.txt

 

    *   sudo apt install - It is responsible for installation, removal, and updating of software in our system

Ø # command is used to download the latest version of your desired application from an online software repository pointed to by your sources. list configuration file and and install that application on your Linux machine.

 

        sudo apt install <soft name>

        sudo apt remove <soft name>

 

    *   dpkg - A medium-level package manager for Debian

Ø # dpkg-deb is a command line tool in Linux used to manipulate Debian package files (which have a .deb file extension).

 

        dpkg <soft name>

        dpkg -i <soft name>

        dpkg -r <soft name>