Ken Lab One Exercises

Exercise 1.1 To reverse the entries in a sort command use '-r'

Exercise 1.2 cd~ signifies the home directory, cd ~hpotter would take you to the user hpotter's home directory

Exercise 1.3 The command to show the first ten lines of a file is 'head' To show any specified number of lines the command is also 'head' followed by -x where x is the number of lines wanted. To find the last 12 lines of a file use tail -12

Exercise 1.4 'pushd' adds a directory to the top of the directory stack, or rotates the stack, making the new top of the stack the current working directory. 'popd' removes entries from the directory stack. 'dirs' displays the list of currently remembered directories.

Exercise 1.5 To print on the default printer use 'lpr -Plaser' followed by the name of the file. To check it made it use 'lpq'

Exercise 1.6 To get help try the man page, if that doesn't work use help or use '-h' as a flag

Exercise 1.7 To ignore changes in blank lines use '-B' and to ignore case use '-i'

Exercise 1.8 Anyone can read earth.txt, the only person that can write on earth.txt is the user aturing, to allow other people to edit or delete a file use the command 'chmod' followed by who you're targeting when u= user, g= group, o =other, and a +/- and r= read, w= write, x =execute

Exercise 1.9 rm a??.txt

Exercise 1.10 To make other users unable to read/edit/execute your files use 'chmod -R o- rwx'

Exercise 1.11 cd HOME will take you to your HOME directory, cd $HOME will take you to whatever variable is stored in $HOME

Exercise 1.12 grep carpentry followed by the name of the file

Exercise 1.13 analyze myfile | head -100 | tail -50 to show lines 50-100,

Exercise 1.14 One greater than sign overwrites the file assigned, two greater than signs append the file assigned

Exercise 1.15 find/ -maxdepth 1 ./lecture -type 'd' ./lecture means that's where you start looking, -maxdepth 1 shows how far down to look, the command to find things is 'find', 'd' stands for directories. find finds things by name or type

Exercise 1.16 rm *.ch? remove files that end in .ch?, rm *.ch? removes any files that have .ch in it.

Exercise 1.17 Use ps aux | grep followed by the program you're looking for such as bash or svchost.exe

Exercise 1.18 To bundle up files use tar- cf followed by the name you want to make ur tar file followed by what files you want to bundle up or which directory to take files from. To compress the tar file follow tar- with gzip

Exercise 1.19 diff version 1 against version 2

Exercise 1.20 Use passwd to change your password

Exercise 1.21 -n following grep gives the line number, to pass at a pattern use -x to do regular expression matching

Exercise 1.22 NA

Exercise 1.23 Prints the list of aliases in the form alias NAME=VALUE on standard output.