Echo the content of a command stored in a variable or just make use of it. Special redirect.
Run a command with the output of another command.
' -> backtick
touch file_etc.txt
vi file_etc.txt -> write '/etc' in the file and save it
ls -l 'cat file_etc.txt' -> output the content of /etc folder
ls -l 'cat file_etc.txt' | wc -l -> numeber of files
ls -l 'cat file_etc.txt' > etclist.txt -> redirect the /etc files into the file etclist.txt
1. etcdir='ls -l /etc' -> set a variable 'etcdir' that list the /etc folder
set | grep etcdir -> lists the files from 'etcdir' variable that displays /etc folder in an ugly way
echo "$etcdir" -> the format is nice now
2. etcdir1=$(ls -l /etc)
set | grep etcdir1
echo "$etcdir1" -> prints in a nice way
foldercount='ls -A | wc -l'
echo $foldercount -> number of files
if $foldercount -gt 10 do something
pico file_etc.txt and add /bin folder
ls -l 'cat file_etc.txt' -> list the content of /etc and /bin in alfabetical order
du -h 'cat file_etc.txt' -> (du -disk utilization) list the disk utilization for /bin and /etc folders for each file in part
netstat -ant | grep 443 -> monitor the process that run on port 443
sslstatus='netstat -ant | grep 443'
echo $sslstatus -> returns the number of processes runing on port 443
touch file.txt
echo line1 >> file.txt -> append a line to the file
echo line2 >> file.txt
filelist='< list.txt' -> '<' redirection of input
echo $filelist -> print the content of the file on the same line
No comments:
Post a Comment