DEV Community

Cover image for Linux Commands Part 1:
MuthuKumar
MuthuKumar

Posted on • Updated on

Linux Commands Part 1:

fmt command:

$ cat > fmt.txt
hai
all welcome
to
ILUGC

$ cat fmt.txt
hai
all welcome
to
ILUGC

$ fmt fmt.txt
hai all welcome to ILUGC

Image description

hostname:

$ hostname
localmachine

Image description
$ hostname -I
192.168.1.100 192.168.122.1 172.17.0.1

Image description

$ sudo hostname <new_hostname>
Example:
$ sudo hostname host
1.
Image description

2.

  • Enter the Password:

Image description

  • close the terminal and again open the terminal:

the hostname has been changed

Image description

to set the host as hostname
$ sudo hostname host

  • 1.
    Image description

  • 2.
    Image description

locate command:

  • find the file name quickly

$ sudo updatedb

once created the file after update db using below mention the command

Image description

$ locate fmt.txt
/home/muthukumar/fmt.txt

Image description

  • i have created the one text file name of secret and then using locate secret.txt and hit the enter but location is not showing in my terminal why ? ..not showing in the location because in this file not update in the db . so you have used this command sudo updatedb then next you have using the command and check secret.txt Result Showing:

Image description

Top comments (0)