Posts

Showing posts from April, 2021

Keystrokes

  Unix  Keystrokes Ctrl-c Stops a command or program that is currently being executed. Ctrl-d Removes you from the current environment, this will log you out of the system if you are at a shell prompt. Ctrl-h, Del Deletes the last character typed and moves back one space. Unlike DOS, the backspace key does not work! Ctrl-q Resumes the command that was halted by Ctrl-s. Ctrl-s Temporarily halts the current command being executed, e.g. scrolling of text on the screen. Ctrl-u, Ctrl-x, @ Cancels what you have just typed, so that you can start again. Ctrl-x Deletes the current line of text being entered. ctrl c is used to kill a process. It terminates your program . ctrl z is used to pause the process. It will not terminate your program, it will keep your program in the background. You can restart your program using the command fg

Miscellaneous and Shell Programing Commands

Image
Unix :   Miscellaneous Commands : date : Prints system date and time cal : displays calendar exit : cause process to terminate/ shell to exit clear : clears the terminal screen banner : banner command in Linux is used to print the ASCII character string in a large letters to standard output. banner has a default capacity of 10 characters in a word. After that, you have to give space Banner 1234567890 Shell Programing :    read : used to read a line from standard input/ read from file expr : used to evaluate expressions and arguments as an expression echo : displays line of text and arguments to standard output sh : sh is a shell, which is command-line language interpreter source :  is a shell built-in command which is used to read and execute the content of a file(generally set of commands), passed as an argument in the current shell script. To pass a path_name of a file as an argument where, /home/sc/sourcefolder/ is the file directory here. The content of the...

Information Commands

Image
Unix   Information Commands : who : displays who were logged into the system W : gives you who logged in what they are doing(like which shell they are using) Who am i : displays currently using user and login time man : it is used to display complete information of command including options whatis : Gives you short line description of commands finger : Finger command is used to display the information of system users [mssusr18@MSS-DB2 omsai]$ finger Login     Name       Tty      Idle  Login Time   Office     Office Phone mssusr1              pts/7       4  Jun 12 12:43 (172.17.14.48) mssusr18             pts/0          Jun 12 12:11 (172.17.13.29) mssusr3              pts/3          Jun 12 12:39 (172.17.14.127) mssusr4          ...

Text manipulation/ Searching Commands

Image
Unix Text manipulation/ Searching Commands grep : it is used to search patterns and print lines matching with pattern grep hello file1 grep world sample sample2 sample3 → it searches world word in 3 files(sample, sample2, and sample3) awk - Finds and Replaces text, database sort/validate/index awk 'END { print NR }' file1 → To print count of lines in a files awk 'BEGIN { for (i = 1; i <= 7; i++) print int(101 * rand()) }' → To print seven random numbers from zero to 100, inclusive. awk { print $2 } file1 → Used to display second line of file1 sed : SED command in UNIX stands for stream editor and it can perform lots of functions on files like, searching, find and replace, insertion or deletion. Though most common use of SED commands in UNIX is for a substitution or for find and replace. It just prints with modified patterns but not save in the files $sed 's/unix/linux/' file1 → replace(substitute) word unix with linux $sed 's/unix/linux/2' file1 → ...

Process/Job Control Commands

Image
Unix    Process/Job Control Commands ps : gives current process status kill : used to terminate process bg : runs the job in the background fg : runs the job in foreground top : displays top Linux tasks, which are currently running,  stopped, and sleeping cron : used to schedule jobs Cron Table Format *     *     *   *     *   Command_to_execute |     |     |     |   |       |     |     |     |     Day of the Week ( 0 - 6 ) ( Sunday = 0 ) |     |     |     | |     |     |     Month ( 1 - 12 ) |     |     | |     |     Day of Month ( 1 - 31 ) |     | |     Hour ( 0 - 23 ) | Min ( 0 - 59 ) To Install or update job in crontab, use -e option $ crontab -e To List Crontab entries, use -l option...