Karteikarten
UNIX Commands

Karten in diesem Stapel (35)
- 1what is the structure of a unix commandCOMMAND FLAGS PARAMETER(S)
- 2what are flagsFlags are options available on commands. Not all commands need flags. Some REQUIRE them.
- 3how are spaces used in commandsspaces need to seperate the command from the flags, and the flags from the parameters, and the parameters from other parameters.
- 4lsusage: ls directoryPathname -- lists items in specified directory.
Flags: -l -a (there's more too!) - 5catview file contents
usage: cat filenameToView - 6moreview file contents, but pause each screen. Page through each screen with space bar.
usage: more filenameToView - 7lessview file contents, pause each screen, space bar, use of arrow keys.
usage: less filenameToView - 8touchcreates file or updates file timestamp
usage: touch SomeFilename - 9cpcopy file to another file or location
usage: cp WhatToCopy WhereToCopyTo
Flags: -i -r - 10mvmove file to another file or location (move file to another file, whaaaaaa?)
usage: mv WhatToMove WhereToMoveTo - 11rmremove file (or directory... hmmmmm...)
usage: rm FileToDelete - 12pwddisplays absolute pathname to current directory
usage: pwd - 13mkdircreate directory
usage: mkdir NewDirectoryName - 14rmdirremove directory (EMPTY ONES ONLY!)
usage: rmdir DirectoryToRemove - 15cd(change directory) navigate through directories
usage: cd WhereToMoveTo - 16wcword count
usage: wc FileToTakeWordCountOf
flags: -w -c -l - 17passwduse this command to change your account password
- 18manuse the man command with any other command name as a parameter to open up a manual page to see useage notes and flags available with any unix command. (you can also list any command name with --help afterwards to see a smaller help page).
- 19FilesA well defined repository of information
● Program or component of a program
● Arbitrary text
● An executable (binary text)
● Special files called directories contain or point to other files - 20Structure of DirectoriesHierarchically structured like an inverted tree
● / is the starting directory or “root” - 21PathnamesLocating a file by following a sequence of directories until you
reach the file
● / is also the separator between the directories and final file - 22Example set of directories and files

- 23what are absolute pathnamesstart at root
● /home/lister/ships/Starbug
● /bin - 24Special symbols for current directory and parent● “..” refers to parent directory (the directory “above”)
● “.” is current directory - 25Referencing user directories~rimmer is the absolute pathname to the user directory “rimmer”
(in the directory “home” in this example)
● ~/ is shorthand for the path to your own user directory - 26what is an absolute pathnameAny pathname beginning with / starts from the
ROOT and is also an ABSOLUTE pathname. - 27what's special about any pathname beginning with ~Any pathname beginning with ~ starts from the
HOME DIRECTORY - 28is the double slash necessary when referring to a directoryThe pathnames: ../.. and ../../ are the same thing.
The ending slash is optional and both paths will
refer to the same directory. - 29Characters in filenamesFile names can contain any characters except “/”,
but it is recommended that you use upper or lower
case letters, numbers, and the characters “-” “.” - 30how do you manage file names with spacesalthough a file name could contain a
space or spaces:
confusing name
commands using this would not work correctly unless you
tell the shell to not break an argument at the spaces by
quoting the filename.
rm “confusing name” - 31what does an asterisk doan asterisk “*” matches any number of characters in a
filename
● con* will match con, condor, constant.exe
● *.c will match all files that end in .c
● rm * will remove all the files in a directory
a “?” matches any single character in a filename
● b?t will match bit, bot, bat. It will not match bt or boot
● square brackets “[]” will match any one of the characters in
the brackets. A hyphen “-” can be used to match any of a
range of consecutive characters.
● [bhr]at will match bat, hat and rat
● chap[5-8].c will match chap5.c, chap6.c, chap7.c and chap8.c - 32what types can access a file● user or owner: process spawned by user who created file
● group: process spawned by members of the same group
● other: process spawned by anyone else - 33what are the permission typesread: access file or list directory
● write: write to / remove file (directory)
● execute: run file as a program or enter directory - 34how can you view current permissionsCurrent permissions can be viewed using ls -l
● First line is the number of disk blocks ( 1 block is 512
bytes) taken up by all the files - 35changing permissions● Symbolic
● Format: chmod [who] [operation] [permissions]
● who is one or more of u, g, o
● operation is + (add), - (remove), = (set)
● Permissions are one or more of r, w, x
● Examples
chmod go-rwx myfile.doc
chmod g+w myfile.doc
chmod u=rwx,g=rx,o=r myfile.doc
Informationen
- Beschreibung
- Karteikarten am UNIX Commands, erstellt von Olivier Joseph am 04/10/2018.
- Erstellt von
- Olivier Joseph
- Aufrufe
- 0
- Bewertung