Linux

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 3

cd -- Change Directoy

PWD -- print working directory


ls -- list of directory n files
---------------------------------------------
create Directory
cmd -- mkdir e.g. mkdir IZYDIR
----------------------------------------------
crete files
cmd -- touch e,.g. touch IZYFile
----------------------------------------------.
cmd for finding files in directories
find . -name "file"
----------------------------------------------
Locate CMD
locate directory name
----------------------------------------------
WildCards
TO create files automatically.In thses we dont have to create multiple files
manually.

touch abcd{1..9}-xyz
rm abcd* -- is to remove file
----------------------------------------------
Soft and Hard Links (ln)

-----------------------------------------------
cmd -- who, last, finger
these r the cmd to see who loggedin and when..
-----------------------------------------------

Types of Permissions
Read, Write, Execute -- RWX

File Permission changinng mode


cmd for channing mode --- chmod

to remove permission -- chmod -rw jerry


to add permission -- chmod +rw jerry
-----------------------------------------------

Change ownership cmd


-- chown username filename e.g. chown taha izyfiles
---chown groupname filename e.g. chown taha izyfiles
---------------------------------------------------------

Remove Directory cmd --


rm -r directory name
------------------------------------------------

Access Control List


To add permission for user
setfacl -m u:taha:rwx /path/to/directoryrw
-------------------------------------------------

Adding Text to Files


e.g.
mkdir IZYDIR
touch IZYFile
echo "hello how r u" >IZYFile
echo "who r u" >> IZYFile

cat IZYFile
hello hor r u
i am fine
-------------------------------------------------
CMD - *cat - these cmd is used to display the messages.
-------------------------------------------------------
head - these cmd will give first 2 line of messages.
-----------------------------------------------------------
tail - these cmd will give last to line of messages.
------------------------------------------------------------

cmd *Cut
cut --version - these cmd is for checking the verion of cut.
cut -c1 filename
cut -c1,2,4
cut -c1-2 filename
--------------------------------------------------------------
CMD *sort
these cmd is used to sort file in a alphabetic format e.g. abcdefg..
---------------------------------------------------------------
cmd *wc
wc cmd is uded to read the characters in messages or count the words in the
messages.
-------------------------------------------------------------------------
DIFF n CMP
-----------------------------------------------------------------------

Compress and uncompress


cmd *tar is used for compress n uncpmress the files --- tar cvf taha.tar . --
thses cmd is to compress the files
cmd gzip is used to compress the file ---- tar xvf taha.tar
gzip -d or gunzip is used to uncompress the file
---------------------------------------------------------------------------
Truncate File Size (truncate)
these cmd is used to extend the size of the file.It removes the bytes from the file
once it remove it will no come back.

cmd * truncate -s 40 filename


----------------------------------------------------------------------------
Splitting cmd
split -l 2 filename
-------------------------------------------------------------------------------

vi editor
vi filename
Shift+i to insert
type message
Shift+esc to escape
shidt+zz to save n exit
then do cat to verify itSS
----------------------------------------------------------------

commands
su - username
sudo - command
-----------------------------------------------------------------------------------

What is Kernel??
A Kernel is a interface lies between hardware and a software.

What is a Shell??
A shell is a interface that lies between user and a kernel.

You might also like