Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
3 views10 pages

Dev Ops Notes

Uploaded by

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

Dev Ops Notes

Uploaded by

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

Switch user to root>> sudo su root

Logged in as root user

Lab1:

1.Command: ls
will list all the files and directories in current directory.

Currently empty directory and no files present.

To create a file in Linux using cat command

2. Command: cat

Cat > help to write text/data into the file, if file already exists it is going to just over write the text you
have entered. If the file does not exist it is going to create new file.
Below screen shots with few commands executed with cat
Cat >> helps to append the text or data in to the existing file instead of overriding it.

To combine multiple files we can use it like ex: cat file1 file2 >> file3
Cat< used to just read the document, it can also be achieved using just cat and filename. But
internally system by default takes < symbol if nothing was provided after cat.

We can also print the text in reverse order. For this we use tac command.

Ex: tac filename

To write the reverse order to next file we just use the > symbol by mentioning the filename we need
to create
To create a file in Linux using touch command

Touch command main usage is to update file’s modified/accessed datetime. When we use touch
command with file name, if the file already exists it directly change modified/accessed time to
current date time. See below screen shot for ref.

If the file is not available it is going to create a new empty file .

there are different arguments which can use with touch for specific usage.

Touch with “-a”>>it just updates the last accessed time

Can see there is only change at the access time and modified time remains same as previous. In
same way “-m” is used to update only modified date without changing last accessed time.
ls Command:
To create a file in Linux using vi command

If file already exists it supports to edit the data inside the file. If file doesn’t exists new file will be
created and it opens and ask to write the data as shown below.
To insert/update the data inside file need to press “I” and then enter. Once every thing is finished
need to press “Esc”. After that to save the changes need to write “:wq”. If you don’t want to save the
changes that you have made write “:q!”.

Ex: vi file1

To create a file in Linux using nano command

It works the same way vi command works. But there were no multiple steps involved save and exist
the file. You can see the commands in cli itself to execute.

Ex: nano file1

Lab2:

ls -a

Lists all the files in the folder including all hidden files.

Without -a

To create the new hidden file just add . before the filename when you are creating.
mkdir is for creating new directory

rm

to remove the files and directories from folder.

cp

To copy file from one location to another location, we can also copy content of one to another

mv

To move one file from one location another location. We can rename the file and can move.
less

more

head

tail

You might also like