Linux Simple Basic Commands - Tecnew

Home Ads

Linux Simple Basic Commands

Linux Simple Basic Commands

Share This

   

   ls Shows the list of file

   ls  -l Shows the long list of files

   ls  -a Shows the list of hidden files

   ls  -la Shows the long list of files along with hidden files and folders

   ls  -lt Shows the list of file sort by time and date

   ls  -ls Shows the list of file long format with file size

   ls  -lh Shows the list of file with readable file size

   ls  -i Shows the list of file with i nodes

   ls  -r Shows the list of file in reverse order

   ls  -R Shows the list of file recursively

   ls  -s Shows the list of file with file size

   ls  -S Shows the list of file sort by file size

   ls  -X Shows the list of file sort by extension

   cd  home Changes the directory in to home

   cd  vagrant/ Change the directory in to vagrant

   cat  svs.txt Displays the file contains

   touch   sv.txt Creates the text file sv

   cd Change the directory in to home

   cd   /temp Changes the directory in to temp

   cd   /home/vagrant/ Changes the directory in to vagrant 

   mkdir  sv Creates the Directory sv

   rm  sv.txt It removes the file sv.txt

   cd   /tmp/sv It change the directory in to sv

   ls list of files and directories

   cd   sv Change directory in to sv

   pwd Present working directory

   cd  .. Change directory one step back

   pwd Present working directory

   cd   /home/vagrant Changes the directory in to vagrant

   cd   /tmp/sv Changes the directory in to sv

   cd          It changes current and previous directory

   history      It shows the all commands in history


creating the link files 

ln -s /home/vagrant/data/tool.txt devtool it will create the softlink of the original file
unlink devtool It unlinks the file
rm devtool It is also unlink the file

Filter by grep command
(grep word file)
grep what file name It means the what is the word contains the file it will searches
grep -i what file name It searches the word by case insensitively
grep -i what *.cfg It searches all files contains .cfg
grep -i what * It searches the all the files in current directory
  
less and more
less file name It shows the information by pressing the down arrow to go down up to go upwords and type q to quit
more file name It shows the information by pressing enter to go down and press q to quit

head and tail
head file name It shows 10 lines from starting
head -20 file name It shows 20 lines from starting
tail file name It shows 10 lines from ending
tail -20 file name It shows 20 lines from ending

tail -f file name It shows the dynamic content it updates in terminal

cut -d: -f1 file name Delimiters is used to shows the colums by separately

Search and replace by Vim editer

:%s/devops/noops/g It replaces the word devops by noops in vim editer
sed -i 's/devops/noops/g' It replaces the word devops by noops

head -5 file name > /tmp/tool.txt It store the first five lines into tool.txt file
head -5 file name >> /tmp/tool.txt It store the first five lines into tool.txt and keeps the previous info

No comments:

Post a Comment