0% found this document useful (0 votes)
9 views3 pages

Linux CMD Cheat1

Uploaded by

prathamgarg2010
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views3 pages

Linux CMD Cheat1

Uploaded by

prathamgarg2010
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Linux CMD Cheat-sheet

Basic Linux commands


Command Descrip on

ls Lists all files and directories in the present working directory

ls -R Lists files in sub-directories as well

ls -a Lists hidden files as well

Lists files and directories with detailed informa on like permissions, size, owner,
ls -al
etc.

cd ~ Navigate to HOME directory

cd .. Move one level up

cd To change to a par cular directory

cd / Move to the root directory

cat > filename Creates a new file

cat filename Displays the file content

cat file1 file2 > file3 Joins two files (file1, file2) and stores the output in a new file (file3)

mv file "new file path" Moves the files to the new loca on

mv filename
Renames the file to a new filename
new_file_name

Allows regular users to run programs with the security privileges of the superuser or
sudo
root

rm filename Deletes a file

man Gives help informa on on a command

history Gives a list of all past commands typed in the current terminal session

clear Clears the terminal

mkdir directoryname Creates a new directory in the present working directory or a at the specified path

rmdir Deletes a directory

mv Renames a directory

apt-get Command used to install and update packages


File Permission commands
Command Descrip on

ls -l to show file type and access permission

r read permission

w write permission

x execute permission

-= no permission

used to modify this permission so that it can grant or restrict access to directories and
Chmod
files

Chown user For changing the ownership of a file/directory

Chown user:group
change the user as well as group for a file or directory
filename

User management commands of Linux


Command Descrip on

sudo adduser username To add a new user

sudo passwd -l 'username' To change the password of a user

sudo userdel -r 'username' To remove a newly created user

sudo usermod -a -G GROUPNAME USERNAME To add a user to a group

sudo deluser USER GROUPNAME To remove a user from a group

finger Shows informa on of all the users logged in

finger username Gives informa on of a par cular user


Networking command
Command Descrip on

SSH username@ip-address or hostname login into a remote Linux machine using SSH

Ping hostname="" To ping and Analysing network and host connec ons

You might also like