-
Use
man
to look up the flag for human-readable output fromls
.$ man ls
And in the man page search:
/human-readable
-
Get help with
man
by typingman man
into the console.$ man man
-
Wouldn't it be nice if there was a calendar command? Use
apropos
to look for such a command, then useman
to read about how that command works.$ apropos calendar $ man calendar
-
Before I organized the photos by year, what command would have listed all of the photos of type
.png
?$ ls *.png
-
Before I organized the photos by year, what command would have deleted all of my hiking photos?
$ rm *hiking*
-
What series of commands would you use in order to put my figures for a data science course and the pictures I took in the lab into their own folders?
$ mv *datasci* data_science_course/ $ mv *lab* lab/
-
Search
states.txt
andcanada.txt
for lines that contain the word "New".$ grep "New" states.txt canada.txt
-
Make five text files containing the names of states that don't contain one of each of the five vowels.
$ egrep -v "a" states.txt >> states_no_a.txt $ egrep -v "e" states.txt >> states_no_e.txt $ egrep -v "i" states.txt >> states_no_i.txt $ egrep -v "o" states.txt >> states_no_o.txt $ egrep -v "u" states.txt >> states_no_u.txt
-
Download the GitHub repository for this book and find out how many
.html
files it contains$ git clone https://github.com/seankross/the-unix-workbench $ cd the-unix-workbench $ find . -name "*.html" | wc -l
-
Use pipes to figure out how many US states contain the word "New."
$ grep "New\." states.txt | wc -l
-
Examine your
~/.bash_history
to try to figure out how many unique commands you've ever used. (You may need to look up how to use theuniq
andsort
commands).$ cat ~/.bash_history | sort | uniq | wc -l