Photo by Jefferson Santos on Unsplash
Day-13 Basic Linux Commands for DevOps part 2
Basic Linux commands
Today we are going to see more basic Linux commands that are useful in a DevOps engineer's day-to-day life.
Linux Commands part-2 ๐จโ๐ป
- file
File_name
: It will show what kind of material( type of content like ASCII, JSON data) a particular file has.file package-lock.json >> package-lock.json: JSON data
- cp
Fiile_name
path
: It will copy a specific file to the specific path. I copiedP2.txt
from my home directory to the Desktop.cp p2.txt ./Desktop/
- whatis
command_name
: It will show the results of a particular command.whatis ls >> ls (1) - list directory contents
find
path
-nameFile_name
: It will locate a certain file at the specified path.find . -name P2.txt
head
Option
File_name
: If the given file is containing hundreds of lines but you just want to see it's few lines than you can use this command. Without any option it will only print first 10 lines from the file content.
head -n 5 p2.txt
>>
This just a file containing randome txt.
1232
zx
qwqa
qqwas
- tail
Option
File_name
: Similar to thehead
, but it prints from the last.
tail -n 5 p2.txt
>>
12wq
adscc
asc23sa
2wawds
23das
- grep
pattern
File_name
: It is used to find a specific pattern in a text file.grep qwas p2.txt >> qqwas qwas
- sudo
command
: It is more like Windows'srun as administrator
feature. Whatever command you run withsudo
will be granted root privileges.
- history : It will show history of all the commands that you run till now in terminal.
history
>>
1 tail -n 5 p2.txt
2 grep 12wq p2.txt
3 clear
4 grep aaws p2.txt
5 clear
6 ls
7 cat p2.txt
8 grep qwas p2.txt
9 sudo su
10 history
Resources ๐
Ending Notes ๐
That was all there was to learning some fundamental Linux commands that are helpful in DevOps. I'll see you shortly the next day.
ย