Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
$ - the Dollar Prompt Basic Commands $ ls -l -al To list the files shows the permissions set for the file shows all hidden files with their respective permissions
$ pwd - Displays your current directory $ cd -> Change Directory $ oslevel Displays the version of the operating system $ whereis ( program name ) displays the path of the program Eg : $ whereis cron cron: /etc/cron /usr/sbin/cron /usr/lib/cron $ who -> displays the users logged into the system $ hostname shows the hostname of the system $ ifconfig a shows all the ipaddress associated with the system $ lsps a displays the paging space $ prtconf Displays the entire system information $ ps ef Displays the running process in the system $ mkdir (folder name ) Creates a new folder $ rmdir ( foldername ) Deletes a folder
Find Command
One of the commands that everyone should master is the find command. The first, and most obvious, use is find's ability to locate old, big, or unused files, or files that you forgot where they are $ find < directory to search > -name ( name of the file ) Eg : $ find / name racv.doc In the above example the system would search for any file named racv.doc on the root and all subdirectories from the root.
Vi Editor
vi is a family of screen-oriented text editors which share common characteristics, such as methods of invocation from the operating system command interpreter, and characteristic user interface features $ vi opens a new file in the editor $ vi < path><file name > opens the specific file for editing
The first thing most users learn about the VI editor is that it has two modes: command and insert. The command mode allows the entry of commands to manipulate text. These commands are usually one or two characters long, and can be entered with few keystrokes. The insert mode puts anything typed on the keyboard into the current file.
Once you are inside the editor use the following commands to edit
Yank until , putting the result into a buffer. "yy" yanks the current line. a count yanks that many lines. The buffer can be specified with the command. If no buffer is specified, then the general buffer is used.
b Move the cursor back one word. If the cursor is in the middle of a word, move the cursor to the first character of that word. e Move the cursor forward one word. If the cursor is in the middle of a word, move the cursor to the last character of that word. h Move the cursor to the left one character position. j Move the cursor down one line. k Move the cursor up one line. l Move the cursor to the right one character position. w Move the cursor forward one word. If the cursor is in the middle of a word, move the cursor to the first character of the next word.
Replacing Text
C Change to the end of the line from the current cursor position. R Replace characters on the screen with a set of characters entered, ending with the Escape key. S Change an entire line. c Change until . "cc" changes the current line. A count changes that many lines. r
Replace one character under the cursor. Specify a count to replace a number of characters. s Substitute one character under the cursor, and go into insert mode. Specify a count to substitute a number of characters. A dollar sign ($) will be put at the last character to be substituted.
File Permissions:
Every user on a UNIX system has a unique username, and is a member of at least one group (the primary group for that user) Every directory and file on the system has an owner, and also an associated group. It also has a set of permission flags which specify separate read, write and execute permissions for the 'user' (owner), 'group', and 'other' (everyone else with an account on the computer) The 'ls' command shows the permissions and group associated with files when used with the -l option. On some systems (e.g. Coos), the '-g' option is also needed to see the group information An example of the output produced by 'ls -l' is shown below.
drwx------ 2 richard staff 2048 Jan 2 1997 private drwxrws--- 2 richard staff 2048 Jan 2 1997 admin -rw-rw---- 2 richard staff 12040 Aug 20 1996 admin/userinfo drwxr-xr-x 3 richard user 2048 May 13 09:27 public
Understanding how to read this output is useful to all unix users, but especially people using group access permissions. Field 1: a set of ten permission flags. Field 2: link count (don't worry about this) Field 3: owner of the file Field 4: associated group for the file Field 5: size in bytes Field 6-8: date of last modification (format varies, but always 3 fields) Field 9: name of file (possibly with path, depending on how ls was called TAR ARCHIVE tar -cvf (filename or device) ("files or directories to archive") eg tar -cvf /dev/rmt0 "/usr/*"
Lists archive
tar -xvf (filename or device) Restore all tar -xvf (filename or device) ("files or directories to restore") use -p option for restoring with orginal permissions
eg tar -xvf /dev/rmt0 "tcpip" Restore directory and contents tar -xvf /dev/rmt0 "tcpip/resolve.conf" Restore a named file
JOB SCHEDULING $ crontab -l $ crontab -e $ crontab -l > (filename) $ crontab (filename) $ crontab -r $ crontab -v List out crontab entrys Edit crontab entrys Output crontab entrys to a file Enter a crontab from a file Removes all crontab entrys Displays crontab submission time. Schedule a job using at
at (now + 2 minutes, 13:05, etc) {return} Command or schell script {return} {CTRL D} at -l atq at -r (at job No) atrm (at job No)
Lists out jobs scheduled to run via at command Removes an at job scheduled to run.