User Tools

Site Tools


journal:spring2019:bmather2:week2

unix week2


January 24, 2019

Unix is a multi-user, multitasking os
And the class uses a customized version of linux debian

Unix Philosophy:
-Everything is a file
-Small is beautiful
-Do one thing and do it extremely well

Types of files:
-regular
-directory
-special

Various Symbols and Options:

'.' means current position
'..' means previous dir
'~' means home dir
'-l' option for listing info
'-v' for verbose, explain what is going on
'-f' to force command without prompt
'-i' to give you a descriptive prompt
'/dev/null' a place you can redirect things to to discard them

Various commands:

-'man' for manual (can add option to search manual for)

  1. '/' to search and use 'n' and 'N' to go to next an previous instances of search

-'touch' makes a file
-'echo' displays things to terminal
-'cat' show what is in a file
-'mv' when both options are same type it renames, but can be used to put a file in a dir

Redirecting data:
<,«,«< STDIN file for input (keyboard)
1>,1»,1»> STDOUT file for output (terminal)
2>,2»,2»> STDERR file for

Single for write (overwrite)
Double for append (new line when used with echo or cat)

Managing File Permissions:

When using 'ls -l (filename)', the first character of output shows the file type:

'-' for regular regular files
———————–
'd' for directory directories
'l' for link
————————
's' for socket special files
'p' for pipe
'b' for block
'c' for character device

The next three represent the user's permissions
The next three are for the group
And the last three for other

Each space shows a permission on that file for that user/group/other

'-' nothing 0
'x' execute/search 1 these are the
'w' write 2 octal permissions
'r' read 4

Octal permissions are added together for each section and put together to make a code to use with the
'chmod (permission, filename)' command to change permissions
(i.e. 600 = “- rw- — —” read\write only for user)

'tty' shows your terminal number found in /dev/pts
Then you can ls your number from that directory and chmod the permissions (changing write for group disables messages)

The Pipe: '|'
It uses the output of the left side as input for the right

Rules
1. Only use non-interactive commands
2. Only commands that make standard output on left
3. Only commands that use standard input on right

Commands commonly used with a pipe are:

'more' stops output at the end of a page
'less' same as more (but way better) allows more control of view and for searching
'wc' shows info, lines, words, characters (-w for words -l for lines and -c? for characters only)

journal/spring2019/bmather2/week2.txt · Last modified: 2019/01/30 19:19 by bmather2