# LF - Exercises 7
##### 1. Create aliases for:
###### a) a command with options only.
`alias lsall="ls -a"`

###### b) a command with options and arguments.
`alias svagrant="grep -i vagrant vagrant.sh"`

###### c) more than one command.
`alias folcontent="ls ; pwd ; whoami"`

##### 2. Write a command to list hard and symbolic links. → check at ls man pages
`ls -l --color /usr/ | grep "\->"`

##### 3. Execute below commands and explain what they do:
###### a) $ ps aux --sort=-pcpu,+pmem
Report a snapshot of the current processes, `-pcpu` to achieve percentage cpu usage descending, for ascending, use ‘+pmem’

###### b) $ ps -e -o pid,ppid,command,etime
The ps command enables you to check the status of active processes on a system
`-e` displays information about all the processes being executed on the system
`-o`
`pid,ppid,command,etime` are related to the process ID, the parent process's ID, the command that generated the process and etime could put the duration of time.

##### 4. How would you redirect and append stdout and stderr to file “filename”?
`ls; echo "adding a new line"; kil -l; >>file.txt 2>&1`

##### 5. What do below commands do? → Remember what is command in case you don’t know what a command does.
###### a) ls -1 *.txt | tee count.txt | wc -l
The first part is getting all files with txt extention, after that it is redirectioning on a file called "count.txt", finally it is counting lines

###### b) cat *.txt | sort | uniq > listFile
The first part is showing txt files content, so all of the lines are sorted, with `uniq` command repeated lines are removed, this result are redirectioned to "listFile" file

##### 6. What happens if you run > filename command?