Many of the original Unix commands were two (lower case) letters long: the text
ID: 3667861 • Letter: M
Question
Many of the original Unix commands were two (lower case) letters long: the text editor was ed, the copy program was cp, the screen editor command was vi, the change directory command was cd, and so on. Write a shell script called lab5.1 to find all such commands and save in a file called lab5.1.out. Your script should also provide a count of how many such commands there are. Do not use awk. Note that the very oldest UNIX programs reside in the /bin directory. There are other old UNIX commands (as well as newer 2-letter ones) in /usr/bin. However, for this lab, you may only focus on the oldest ones from /bin directory./bin directory.
Explanation / Answer
There are Two ways
1)Using AWK
2) Using normal linux commands
ls /*bin*/?? /*/*bin*/??
OutPut--->
/usr/bin/aj /usr/bin/dc /usr/bin/hd /usr/bin/lp /usr/bin/od /usr/bin/ul
/usr/bin/ar /usr/bin/dh /usr/bin/hg /usr/bin/lz /usr/bin/pg /usr/bin/uz
/usr/bin/as /usr/bin/du /usr/bin/id /usr/bin/m4 /usr/bin/pr /usr/bin/vi
/usr/bin/bc /usr/bin/ex /usr/bin/js /usr/bin/nl /usr/bin/sg /usr/bin/wc
/usr/bin/cc /usr/bin/gs /usr/bin/ld /usr/bin/nm /usr/bin/tr /usr/bin/xz
/sbin/ip /sbin/iw /sbin/tc
/bin/cp /bin/df /bin/ip /bin/ls /bin/mv /bin/ps /bin/sh /bin/su
/bin/dd /bin/ed /bin/ln /bin/mt /bin/nc /bin/rm /bin/ss
/usr/games/LS /usr/games/sl
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.