In: Computer Science
please explain the following command sequences
a) who | grep "Seneca" | sort | uniq >>who<<
b)sort <names > names
c)sort ~/files/phone 1> /dev/null2>phone2
d)ls/root/&> files.log
e)ls/etc/>files.log2>&1
a) who | grep "Seneca" | sort | uniq >>who<<
who command is used to find out the following information
:
1. Time of last system boot
2. Current run level of the system
3. List of logged in users and more.
now grep command will find the user Seneca sort the output in ascending order and unique command will remove duplicate entries and output will be stored in the who file in the current directory
b)sort <names > names
this sort command will give content of the names to sort command and create the output in existing names file old content will be removed.
c)sort ~/files/phone 1> /dev/null2>phone2
sort output of phone file in the home directory's files folder output will be written
> is for redirect
1 is the file descriptor for Standard Out
& is the symbol for file descriptor (without it, the following
1 would be considered a filename)
d)ls /root/ &> files.log
& is the symbol for file descriptor and it will run in background and output will be store in files.log
e)ls /etc/ > files.log2 > &1
output of ls command that is used for file listing of current working directory of etc and store the output list in the files.log2 and this command will run in background and output will not show on terminal
if you have any doubt then please ask me without any hesitation in the comment section below , if you like my answer then please thumbs up for the answer , before giving thumbs down please discuss the question it may possible that we may understand the question different way and i can edit and change the answers if you argue, thanks :)