Basic Linux commands and their functions

Basic Linux commands and their functions
ciphers security

Hello everyone 🙂 anukram here and today I came up with exciting things you all want to know: Linux commands. Today in this article we will discuss most Linux commands and their description example with their working and logic behind them.

Linux is first introduced in 1991, as in CLI (Command line interface). Which is designed for developers and programmers for making their work easy. But most people when they hear the word Linux think, ohh Linux CLI is very complicated and hard to use for regular people. Sometimes this thought is true because not everyone is able to use Linux. The person who wants to use Linux needs to practice and learn its commands for proper working.

So for beginners and even professionals if you missed any of the commands then this will help you with most of the Linux commands. After going through all the things written over here you’ll be able to know all the commands for basic starting in Linux OS.

Most probably Linux is used for many things server, deployment, security audits, security testing, maintaining services, etc. Linux is most popular is users who are involved in the security of any type like network security, computer security, mobile security, server security, etc.

Linux Commands you should know

So let’s start with having a look at all the commands over here

commandcommand full form syntaxFunction
cdChange DirectorycdIt is used to bring you back to your home directory
cdchange directorycd ../it will bring you one directory back
cdChange directorycd ../../brings you two directories back
pwdPresent working directorypwdIt is used to check which directory you’re working
lslistlsthis cmd shows you the all items in your present directory
ls -Rlist itemsls -Rit will list all items in your directory with all items in sub-directories.
clearClearingclearthis is used to clear your terminal or screen. You can do it by using CTRL+L.
mkdir <name for directory>Make directorymkdir test-directory this command will create a directory with the name test-directory. Basically, it is used to create new directories.
touch <file-name>Touchtouch new-file.txtso this creates a text file named new-file in your directory. basically, this command is used to create new files which could a text, bat, word, etc.
rm <file-name>Removerm new-file.txtthis will delete your file which is new-file.txt permanently. This command is used to delete files only.
rmdir <directory-name>Remove Directoryrmdir test-directory this will delete the test-directory but only if the test-directory is empty or else it will give an error that the directory is not empty.
So this command is used to delete empty directories.
rm -r <directory-name>Remove directory recursivelyrm -r test-directoryThis deletes your test-directory if it is containing anything in it then also it will remove it. So this command is used to delete any directory either if it contains any document.
sudoSuperUser Dosudo <command you want to run>sudo enables the admin or privileged user permission with any command. If you want to run any command as root then you need to use sudo before the command.
sudo suSuperUser Do Switch Usersudo suit will switch you to root user privileges. Basically, sudo su is used for switching between the different users in the OS.
apt-get updateAptitude Get Updatesudo apt-get update,
sudo apt update
this is used to resynchronize your packages by the help source.list file from your OS. In general terms, you can say that this is used to sync your application to the current day for getting updates.
apt-get upgradeAptitude get upgradesudo apt-get upgrade,
sudo apt upgrade
this will upgrade or update your application or package to its newest version. it will update your installed packages and application to their latest or newest version.
apt-get full-upgradeaptitude get fully upgradesudo apt full-upgradethis command will fully upgrade all packages and applications, and it will delete the old version of it. With this command, we can save disk space while upgrading our packages and application.
apt-get install Aptitude get install packagesudo apt-get install <package-name>this command will help you to install any package or application from the terminal.
user addAdding a new usersudo useradd <user-name>So basically this command is used to create a new user into the OS.
manmanual man <command-name>this is used to get all the information of how this command is working in background.
passwdPassword setsudo passwdthis command is used to change root user login password
passwdPassword setsudo passwd <user-name>again same command but this command is used to change the login password of a particular user
whoamiCheck userwhoamithis is used to check the current logged-in user’s name from terminal
bashBash Shellbashthis is used to enter in the bash shell mode
chownChange ownershipsudo chown <user-for-assinging:group-name> <file-name> so this command is used to change the ownership of any file to any user and group.
usermodModerating usersudo usermod -a -G <group-name> <user-name>this command is used to add any user to any group. here in the command -a=add, -G= group-name.
userdelDelete Usersudo userdel <user-name>By this, you can delete any user
cpCopysudo cp <file-name/dir-name> <path>this will help with copying anything from one place to another
mvMovingsudo mv <file-name/dir-name> <path>this is the same as copy command but here we are moving the thing which means it will get deleted from its last location

Permission Management on Linux

ciphers security Debian
PermissionNumber
Read permission4
Write Permission2
Execute Permission1
No Permission0

To change the permission of any file

chmod <permission-number> <file-name\\directory-name>

imagine that we have a file test.txt and we want o give read,write,and execute permission to user and read and write permission to group and read permission for others then

chmod 764 test.txt

To give/remove execute permission for other user

chmod o+x <file-name>

for removing execute permission

chmod o-x <file-name>

command for checking the path of password and shadow file

path of password file is  /etc/passwd

path of shadow file is  /etc/shadow

Note:- password file is owned by the root. So by this, we can say that the user root has the read and write permission of the password file. Shadow has also the same permission as the password file with the root user.

Shadow file is a very confidential file for our system because it contains all password hashes in it.

If you have any queries regarding the above content, or you want to update anything in the content, then contact us with your queries. You can directly post your question in the group.

Connect with us on these platforms




RECENT POST

Connect with us