Linux
Linux
1. ls Command:
(or)
->Environment variables:
it is used to declare variables gloabally using the command echo $varaiable name
Ex: ->echo $var1
here globally var1 is created.
->var1=48
var1 is initialized to a value
->echo $var1
output: 648
->env | grep variable name: it will create the variable locally but we need to
convert to to global variable
so we use the export command to convert the local varoiable in to global variable.
Ex: env | grep var1
->var1=1000
the value is initialized.
-> export variable name:
Ex: export var1
-> to see the gloabal variable we need to call the command
env | grep var1
output: var1=1000
-> we can directly craete a environmenrt variable using the export command-> makes
a variable gloabal
Ex: export var1="yaso"
and for seeing the gloabal variable we need to enter the command env | grep var1
->unset: it is used to clear the exported values in the variable which was globally
declared.
->which command: The which command searches for the location of a command by
searching the PATH variable.
Ex: which ls
output: /bin/ls
->type -a command name: it shows the details of the command withh the path of the
command in it.
->alias variablename="command" : it defines a alias name for the command for faster
use with a single word in linux.
->Functions:
To create a function
Ex: function name () {
>commandsd
>values
}
To calla a function:
Ex: function name
output:
list of details in the function.
->for echo singl quotes and double qoutes are works in different ways.
Ex:
->echo 'hi the path is $PATH'
output:
hi the path is $PATH
->Semicolon command:
it is use to work on multiple commands at a time.
Ex: cal 1 2024; cal 2 2024; cal 3 2024
output:
January 2024
Su Mo Tu We Th Fr Sa
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
February 2024
Su Mo Tu We Th Fr Sa
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
March 2024
Su Mo Tu We Th Fr Sa
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
->Ampersand:
it is used to display a command within a single line
Ex: ls /etc/ppp && echo hi
output:
ip-down.d ip-up.d
hi
->Double pipe:
Ex:
ls /etc/ppp || echo hi
output:
ip-down.d ip-up.d it is executed because if there is working command with the
output the other command cant be executed.
If the command has error the other command works well.
Ex: ls /etc/junk || echo failed
output:
ls: cannot access '/etc/junk': No such file or directory
failed
->cat file name: it displays thre content of the file we stored in it.
->echo "text" > filename: to store in file and the previous data will be deleted.
->echo "text" >> filename: to edit the file without deleting previous data and adds
new content in to it.
->Client A client is a host that is accessing a server. When you are working on
a computer surfing the Internet, you are considered to be on a client host.
->Router Also called a gateway, a router is a machine that connects hosts from
one network to another network. For example, if you work in an office environment,
the computers within the company can all communicate via the local network created
by the administrators. To access the Internet, the computers would have to
communicate with a router that would be used to forward network communications to
the Internet. Typically when you communicate on a large network (like the
Internet), several routers are used before your communication reaches its final
destination.
->ifconfig: it shows the details of the ip address and it can also be used to
change the ip configurations.
->Groups:
->groupmod -n newfilename oldfilename: it will modify the group name with the new
one and with the same group id it was assigned.
->groupdel groupname: it will delete a group we created.
Users and Ownerships: