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

Basic Linux Commands For Beginners

This document provides a comprehensive list of basic Linux commands for beginners, including commands for navigating directories, managing files, and obtaining help. It covers essential commands such as 'pwd', 'cd', 'cp', 'mkdir', and more, along with examples for each command. Additionally, it includes advanced commands related to system management and networking, making it a useful reference for new Linux users.

Uploaded by

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

Basic Linux Commands For Beginners

This document provides a comprehensive list of basic Linux commands for beginners, including commands for navigating directories, managing files, and obtaining help. It covers essential commands such as 'pwd', 'cd', 'cp', 'mkdir', and more, along with examples for each command. Additionally, it includes advanced commands related to system management and networking, making it a useful reference for new Linux users.

Uploaded by

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

Basic Linux Commands for Beginners

Basic:

pwd ==> print the name of current directory || Ex: pwd


***********************************************************************************
*************
whoami ==> print the current user || Ex: whoami
***********************************************************************************
*************
cd [directoryName] ==> enter a directory || Ex: cd Music
***********************************************************************************
*************
cd .. ==> go back to the parent directory || Ex: cd ..
***********************************************************************************
*************
cp [file] ==> copy file || Ex: cp music.mp3
***********************************************************************************
*************
ls ==> list all items in the current folder || Ex: ls
***********************************************************************************
*************
clear ==> clears the terminal || Ex: clear
***********************************************************************************
*************
mkdir [foldername] ==> makes folder with the specified name || Ex: mkdir Songs
***********************************************************************************
*************
rmdir [foldername] ==> removes the specified folder || Ex: rmdir Songs
***********************************************************************************
*************
echo [param] ==> outputs the value of the variable || Ex: echo "Hi"
or string to stdout
***********************************************************************************
*
tree ==> lists the files in the current || Ex: tree
directory in tree like format
***********************************************************************************

For sorting files:

mv [file] [newname]==> rename a file or folder || Ex: mv exe txt


***********************************************************************************
********
cat [filename] ==> reads the specified file || Ex: cat cmds.txt
***********************************************************************************
*******
tac [filename] ==> reads the specified file in reverse || Ex: tac cmds.txt
***********************************************************************************
********
tail [file, file] ==> reads first 10 lines of the files || Ex: tail cmds.txt
***********************************************************************************
**********
zip [file, file] ==> compresses the specified files || Ex: zip files
***********************************************************************************
*********
vi [file] ==> edit file in the terminal || Ex: vi cmds.txt
***********************************************************************************
**********
gedit [file] ==> edits the file in text editor || Ex: gedit cm.txt
***********************************************************************************
*********
nano [file] ==> edit file in nano editor || Ex: nano cmds.txt
***********************************************************************************
********
tar ==> same as bzip2 || Ex: tar file
***********************************************************************************
*************
bzip2 -z / -d ==> compress and decompress files with || Ex: bzip2 -z cmds
the extension "bz2" respectively
***********************************************************************************
*********
gzip ==> same as bzip2 but compresses files || Ex: gzip file
with a gz extension.
***********************************************************************************
*********

Getting help:

man [command] ==> show the manual of the command || Ex: ls man
***********************************************************************************
*******
[command] --help ==> similar to man but ouputs in terminal || Ex: pwd --help
***********************************************************************************
*******
apropos [word] ==> search for the word in description || Ex: aprpos list
of all commands
***********************************************************************************
******

More advanced:

reboot ==> reboot the system || Ex: reboot


***********************************************************************************
********
which [command] ==> ouputs the location of the command || Ex: which ls
***********************************************************************************
********
su [username] ==> impersonate as the specified user || Ex: su root
***********************************************************************************
********
id ==> print user and group information || Ex: id
***********************************************************************************
***********
hostname ==> display or seta computer s hostname || Ex: hostname
***********************************************************************************
***********
uname -a ==> show all the information of the OS || Ex: uname -a
***********************************************************************************
***********
exit ==> exit the current user or the terminal || Ex: exit
***********************************************************************************
***********
shutdown -P +min ==> shutdowns the system || Ex: shutdown -P
***********************************************************************************
***********
Networking:

ifconfig ==> lists all the network interfaces on || Ex: ifconfig


your machine
***********************************************************************************
*********
netstat ==> displays network connections for TCP, || Ex: netstat
routing tables, and a number of network interface and network protocol statistic
***********************************************************************************
**********

To remove a directory (file), use the command -

rmdir directoryname

******************************************************************

Directories can be created on a Linux operating system using the following command:
mkdir directoryname

******************************************************************

For renaming file:


mv filename newfilename

*******************************************************************

The syntax to combine 2 files is


cat file1 file2 > newfilename

*******************************************************************

To view a file, use the command -


cat filename

*********************************************************************

The 'mv' (move) command can also be used for renaming directories. Use the below-
given format:
mv directoryname newdirectoryname

You might also like