join vars /dev/null bash scripting du -k kill process write

ifconfig eth0 - display  network config
pr command makes a two-column report with header headername
pr -2 –h “headername” somefile
 -----------
ls -lart | grep -in test
-I match either upper or lowercase
-n print the matched line and its line number

 ----------- 
sort
-r reverse order
+x ignore first x fields when sorting
 -----------
NAME[0]="1"
NAME[1]="2"
NAME[3]="3"
echo ${NAME[0]}
1
echo ${NAME[*]}
1 2 3
echo ${NAME[@]}
1 2 3

 ----------- 
val=`expr 2 + 2`
echo $val
4
a=10
b=20
val=`expr $a + $b`
echo $val
30
=====
cat test
Some test here
Hello how are you
wc -l < test
2
cat test | wc -l
2
-=-=-=-
/dev/null will redirect STDOUT to a BLACK HOLE
By default:
stdin  ==> fd 0
stdout ==> fd 1
stderr ==> fd 2
How to empty or clear the contents of an existing UNIX file
cat /dev/null > blah.txt
-=-=-=-=-=-=-
last command shows recent logins by all users.
-=-=-=-=-=
cat t
#!/bin/sh
#define your function here
Hello(){
echo "hELLO World $1 $2"
}
#Invole your function
Hello Zara Ali
Output:
./t
hELLO World Zara Ali
-- -- -- -- -- -- -- --
sed ‘1,2d’ lines starting from 1st till 2nd are deleted
cat t | sed '1,2d'
#define your function here
Hello(){
echo "hELLO World $1 $2"
}
#Invole your function
Hello Zara Ali
- -- --  - - - - - -
cat t | sed 's/your/my/'
#!/bin/sh
#define my function here
Hello(){
echo "hELLO World $1 $2"
}
#Invole my function
Hello Zara Ali
-=-=-=-=-=-
cat t | sed '/your/d'
#!/bin/sh
Hello(){
echo "hELLO World $1 $2"
}
Hello Zara Ali
-=-=-=-=-=-=-=-=-
Delete all files which contain the sequence "del". What command did you use?
rm -i *del*
+++++=
Identifies the file type
file w
w: ASCII text
shows the location of a file
whereis cat
/bin/cat
Displays the disk space usage in kb
df –k
shows disk space usage on a particular directory
du –h
+++++=
displays disk usage and limits for a user of group
quota
allows to change password for user username
passwd username
to change the account name mcmohd to mcmohd20 and change home directory accordingly
usermod –d /home/mcmohd20 –m –l mcmohd mcmohd20
kill –l
kill -9 1001
awk – pattern scanning and processing language
-=-=-=-=-=-
cat country
1 Italy
2 Spain
3 Ukraine
4 Poland
cat city
1 Rome
2 Madrid
3 Kiev
join country city
1 Italy Rome
2 Spain Madrid
3 Ukraine Kiev
-=-=-=-=-=-=-
write ok74010 pts/13
hello
=++++
printenv
display value of a shell variable
top
display all system processes
w
show what logged in users are doing

Comments

Popular posts from this blog

HAproxy logging

tomcat catalina coyote jasper cluster

NFS mount add in fstab _netdev instead of default | firewall-cmd --list-all