You are on page 1of 26

LINUX

COMMANDS
What Is a Linux
Command?

a set of instructions
given to the Linux
operating system to
What Is a Linux
perform a specific Command?
task or set of tasks

can be entered in a
command-line interface
(CLI), which is also known
What Is a Linux
as a terminal Command?

can be used to perform


various tasks, from
package installation to
What Is a Linux
user management and file Command?
manipulation.

Linux Commands
Linux Commands

ls
used to list files and directories in the current working
directory
Linux Commands
Linux Commands

pwd
allows you to print the current working directory on your
terminal.
Linux Commands
Linux Commands

mkdir
The mkdir command allows you to create directories from
within the terminal. The default syntax is mkdir followed
by the directory name.
Linux Commands
Linux Commands

cd
The cd command will help you to navigate through
directories
Linux Commands
Linux Commands

cp
The cp and mv commands are equivalent to the copy-
paste and cut-paste in Windows.
Linux Commands
Linux Commands

rm
The rm command is used to delete files and folders
Linux Commands
Linux Commands

sudo
Short for superuser do, sudo lets you perform tasks that
require administrative or root permissions.
Linux Commands
Linux Commands

chmod
chmod is a common command that modifies a file or
directory’s read, write, and execute permissions.
Linux Commands
Linux Commands

chown
lets you change the ownership of a file, directory, or
symbolic link to a specified username.
Linux Commands
Linux Commands

How do I change directory permissions in Linux?


chmod +rwx filename to add permissions


chmod -rwx directoryname to remove permissions.
chmod +x filename to allow executable permissions.
chmod -wx filename to take out write and executable permissions.

Note that “r” is for read, “w” is for write, and “x” is for execute.
Linux Commands
Linux Commands
Linux Commands
Linux Commands

wget
lets you download files from the internet
Linux Commands
Linux Commands
What are octal values?
When Linux file permissions are represented by numbers, it's called numeric mode. In
numeric mode, a three-digit value represents specific file permissions (for example,
744.) These are called octal values. The first digit is for owner permissions, the second
digit is for group permissions, and the third is for other users. Each permission has a
numeric value assigned to it:
r (read): 4
w (write): 2
x (execute): 1
Linux Commands
Linux Commands
In the permission value 744, the first digit corresponds to the user, the second digit to
the group, and the third digit to others. By adding up the value of each user
classification, you can find the file permissions.
For example, a file might have read, write, and execute permissions for its owner, and
only read permission for all other users. That looks like this:
Owner: rwx = 4+2+1 = 7
Group: r-- = 4+0+0 = 4
Others: r-- = 4+0+0 = 4
The results produce the three-digit value 744.
Linux Commands
Linux Commands

apt-get [options] (command)


apt-get
used for handling Advanced Package Tool (APT) libraries
in Linux.
Linux Commands
Linux Commands

ssh
The ssh command allows us to connect to an external
machine on the network with the use of the ssh protocol.
Linux Commands
Linux Commands

man [command_name]
Example : man ls

man
provides a user manual of any commands or utilities you
can run in Terminal, including the name, description, and
options.
Linux Commands
Linux Commands

useradd [option] username


useradd, userdel commands


useradd is used to create a new account, while the passwd
command allows you to add a password. Only those with root
privileges or sudo can run the useradd command.
Linux Commands
Linux Commands

su [options] [username [argument]]


su
allows you to run a program as a different user. It changes the
administrative account in the current log-in session.
Linux Commands
Linux Commands
Bonus Tips and Tricks
Here are some tips and tricks you can use to manage the Linux system:
Enter the clear command to clean the Terminal screen.
Press the Tab button to autofill after entering a command with an argument.
Use Ctrl + C to terminate a running command.
Press Ctrl + Z to pause a working command.
Use Ctrl + S to freeze your Terminal temporarily.
Press Ctrl + Q to undo the Terminal freeze.
Use Ctrl + A to move to the beginning of the line.
Press Ctrl + E to bring you to the end of the line.
When executing multiple commands in a single line, use (;) to separate them. Alternatively, use && to
only allow the next command to run if the previous one is successful.
Thank You.

You might also like