Sie sind auf Seite 1von 4

To log in, perform the following steps: 1. Enter your user name at the login prompt.

If you make a mistake, use the Delete key or Backspace key to correct it. For example, if your user name is larry, enter: login: larry The password prompt appears: login: larry Password: 2. Enter your password. For security reasons, the password does not display on the screen when you type it. The date and time of the last successful and unsuccessful login: Last successful login for juanita: date and time on tty03 Last unsuccessful login for juanita: date and time on tty03 Always check the successful and unsuccessful login information against your activity on the system. If your password is about to expire, the system displays a warning: Your password will expire on date and time The shell prompt, usually a dollar sign ($) prompt or a percent sign (%) prompt. Your systems shell prompt may be different. Super user switcher command $ su or su root # To work as super user; this will prompt for the password $ su <user name> To log out, perform the following steps: 1. Make sure that the shell prompt is displayed. 2. Press Ctrl/D. If Ctrl/D does not work, enter the exit command. Stopping command execution process enter Ctrl/C. To create user account $ useradd <user name> To set or change users password $ passwd <user name> For Network based user type $ yppasswd <user name> To access manual or reference regarding systems and commands $ man <item/command> $ man k <item/command> # for accessing whatis database on system $ man f <item/command> # for one line reference from manual $ apropos <item/command> # for accessing listing appropriate references To change diretory $ cd To list files and diretory $ ls {options} or $ ls {options} <directory_name> To display file on console $ cat <file> $ more <file> # Paginate $ pg <file> # Paginate $ page <file> # paginate $ pr <file> # simple format To print or check printing queue $ lpr <file> # To print a file $ lpr P <Printer_Name> <file> # To print a file on a specific printer $ lpq # To check printing queue

$ lpq P <Printer_Name> <file> # To check job in queue of printer $ lprm P <Printer_Name> <job> # To cancel printing job Directory and files manipulation $ pwd # To display present working directory $ df # To discover partition and directory attributes $ ln <directory/filename> <link name (directory/file name> #Hard link $ ln s <directory/filename> <link name (directory/file name> #Soft link $ cp file(source) directory/file(destination) $ cp r directory(source) directory(destination) $ mv oldfilename newfilename # Renaming file if in the same directory but move(cut and paste) if file moved to different directory or partition. $ diff file1 file2 # To compare two text files $ sort file # To sort contents of text file $ rm file # To remove file $ rmdir directory_name # To remove directory name $ file file # To determine file type Files and directory permissions and ownership manipulation User Class Operations Permissions type owner group others rwx rwx rwx r read w write x execute d (directory) l (symbolic link) c (character special file) p (named pipe special file) s (local socket special file) b (block special file) Use one or more of these letters to represent the userclass: u User (owner) g Group o All others (besides owner and group) a All (user, group and all others) Use one of these symbols to represent the operation: + Add permission Remove permission = Assign permission regardless of previous setting $ ls l # To display file or directory permissions $ chmod userclass-operation-permission filename For e.g chmod u+w file Specifying permissions using octal numbers $ chmod Octal Number file/directory An octal number corresponds to each type of permission: 4 = read 2 = write 1 = execute To specify a group of permissions (a permissions field), add together the appropriate octal numbers (r, w and x denote read, write and execute respectively): 3 = -wx (2 + 1)

6 = rw- (4 + 2) 7 = rwx (4 + 2 + 1) 0 = --- (no permissions) List of the eight possible permission combinations. Permission Combinations Octal Number Binary Number Permissions Code Permissions description 0 000 None No permissions granted 1 001 --x Execute 2 010 -wWrite 3 011 -wx Write/execute 4 100 r-Read 5 101 r-x Read/execute 6 110 rwRead/write 7 111 rwx Read/write/execute The entire permission code for a file or directory is specified with a 3-digit octal number, one digit each for owner, group and others. Octal Number 777 755 700 666 Owner Field rwx rwx rwx rwGroup Field rwx r-x --rwOthers Field rwx r-x --rwComplete Code rwxrwxrwx rwxr-xr-x rwx-----rw-rw-rw-

To set default permissions on file/directories $ umask # To check default permission value $ umask Octal Number # To set default permission

To change ownership of a file or directory for user and group $ chown username file/directory $ chgrp groupname file/directory To check identity of user $ whoami $ who u # To perform Word Count $ wc <file> To check number of users login $ w Shell Notation for Reading Input and Redirecting Output
< > >> Notation Action Example Reads standard input from a file Writes standard output to a file Appends (adds) standard output to the end of a file wc < file3 ls > file3 ls >> file3

Monitoring processes. $ ps $ ps p <PID_Number> $ ps ef $ ps au $ jobs l $ kill <PID_Number> $ kill %<Job_Number> $ Press Ctrl+C $ Press Ctrl+Z $ bg $ fg $ n

# # # # # # # # # # #

To To To To To To To To To To To

check a specific process. check all processes in system. check all processes and login users. display job number and process ID. kill process number. kill process number (C shell only). kill a process. suspend a process. check background process. check foreground process. resume a process in foreground.

$ n &

# To resume a process in background.

Shell Informtaion:
Supported shells and prompts
Shell Name sh Rsh csh ksh sh Default Prompt $ $ % $ $

Shell Bourne Restricted Bourne C Korn POSIX

Shell Change $ <shell_Name> # To change shell temporarily. If restricted shell is on shell can not be changed. After using original shell can be restored by typing exit on prompt. $ chsh # To change shell permananetly.
Changing login shell for user. Old shell: <Old Shell Name and Path> New shell: <New Shell Name and Path>

Using multiple commands $ <cmd1>;<cmd2>;<cmd3>;<cmd4> # To execute multiple commands in a sequence. $ <cmd1> && <cmd2> # && The shell runs the next command only if the current command completes (a command indicates successful completion when it returns a value of zero). $ <cmd1> || <cmd2> # || The shell runs the next command only if the current command does not complete. $ <cmd1> | cmd2 # Pipe (|) sign used to provide standard output of one command to standard input of another command. $ (<cmd1;cmd2>);<cmd3> # () To group output of more than one commands executed in subshell. $ {<cmd1;cmd2>};<cmd3> # {} To execute commands in group but not created

Das könnte Ihnen auch gefallen