{"id":55,"date":"2014-05-11T22:50:48","date_gmt":"2014-05-11T22:50:48","guid":{"rendered":"http:\/\/vkrastev1blog.com\/?p=55"},"modified":"2026-10-19T12:20:46","modified_gmt":"2026-10-19T12:20:46","slug":"important-shell-script-commands-which-are-oft-used","status":"publish","type":"post","link":"https:\/\/vkrastev1blog.com\/2014\/05\/11\/important-shell-script-commands-which-are-oft-used\/","title":{"rendered":"Wichtige Shell-Skriptbefehle, die h\u00e4ufig verwendet werden"},"content":{"rendered":"<p>Here is a list of some important shell commands:<\/p>\n<p>&#8212;- Using Screen command<br \/>\nscreen -ls   &#8212; for a list of avaliable active screens<br \/>\nscreen -x &#8230;. &#8211; the Name from -ls output to join to this active screen<br \/>\nGo out of the Screen with &#8216;ctrl a+d&#8217; without stopping it<\/p>\n<p>&#8212;- Harddisk and folder size<br \/>\ndf -h     &#8211;  filesystemsize<br \/>\ndu -sh *  &#8211;  shows the size of every folder <\/p>\n<p>&#8212;- Who<br \/>\nwhoami &#8211; list current user in current window<br \/>\nwho    &#8211; list all users logged onto the Workstation<\/p>\n<p>&#8212;- Copy file to other Computer<br \/>\nscp filename username@ip-address:\/filepath<br \/>\nfilename is the file to copy and the rest is the Informationen for the remote Computer. You will be asked for a Password of the remote user.<\/p>\n<p>&#8212;- Show Users List<br \/>\ncat \/etc\/passwd | cut -d: -f1<\/p>\n<p>&#8212;- System information commands<br \/>\ndmesg &#8211; (for &#8220;diagnostic message&#8221;) is a command on Unix-like operating systems that prints the message buffer of the kernel. This buffer contains a variety of important messages from those printed during boot to those used for debugging software.<br \/>\nlspci -tv   &#8211; Shows bridjes and main board<br \/>\nlshw        &#8211; Information about installed devices<br \/>\n\/usr\/sbin\/prtconf -v | more  &#8211; Shows the RAM in Unix System<\/p>\n<p>&#8212;- Show Linux version<br \/>\nuname -r<br \/>\ncat \/proc\/version<\/p>\n<p>&#8212;- kill commands<br \/>\nkill -15 pid  &#8212; is graceful Kill<br \/>\nkill -9 pid   &#8212; is forcible Kill <\/p>\n<p>&#8212;- Shows which files are open from the process<br \/>\npfiles processid<\/p>\n<p>&#8212;- Find a file per name<br \/>\nfind \/as -name *stat<\/p>\n<p>&#8212;- Debug script<br \/>\nsh -x script<\/p>\n<p>&#8212;- Vi commands<br \/>\nesc &#8211; in command mode<br \/>\na &#8211; append<br \/>\ni &#8211; insert<br \/>\nq &#8211; quit<br \/>\nw &#8211; write<br \/>\nx &#8211; backspace<br \/>\nd &#8211; delete<\/p>\n<p>shift g \t\t&#8211; springt am last line of text<br \/>\n:^g\t\t\t&#8211; list current line number<br \/>\n:set number\t        &#8211; show line numbers<\/p>\n<p>Cut\/Paste Commands:<\/p>\n<p>    x \t\t&#8211; delete one character (destructive backspace)<br \/>\n    dw\t\t&#8211; delete the current word (Note: ndw deletes n numbered words)<br \/>\n    dd \t\t&#8211; delete the current line (Note: ndd deletes n numbered lines)<br \/>\n    D\t\t&#8211; delete all content to the right of the cursor<br \/>\n    d$\t\t&#8211; same as above<br \/>\n    :u\t\t&#8211; undo last command<\/p>\n<p>Searching and Substitution commands:<\/p>\n<p>\/ [string]\t &#8211; search forward for string<br \/>\n? [string]\t &#8211; search backwards for string<\/p>\n<p>Entering the Insert Mode:<\/p>\n<p>    i\t\t  &#8211; Begin inserting text at current cursor location<br \/>\n    I\t\t  &#8211; Begin inserting text at the beginning of the current line<br \/>\n    a\t\t  &#8211; Begin appending text, one character to the right of current cursor location<br \/>\nshift a\t          &#8211; Begin appending text at the end of the current line<br \/>\n    o\/O\t\t  &#8211; Begin entering text one line below\\above current line<br \/>\n    ESC\t\t  &#8211; Exit insertion mode and return to command mode<\/p>\n<p>&#8212;- Less commands<br \/>\ng       &#8211; go in the begining<br \/>\nshift g &#8211; go ende<br \/>\nshift 7 &#8211; Search<br \/>\nshift \u00df &#8211; Search backwards<br \/>\nn \t&#8211; go to next search match<br \/>\nshift n &#8211; go to before search match<\/p>\n<p>&#8212;- find command<br \/>\nfind . -name &#8220;*Sync*&#8221; -exec grep -l &#8220;501000093347053&#8221; {} \\;<br \/>\n&#8211; finds in the current Folder all files with Name Sync, who have the string XXXX in it<\/p>\n<p>&#8212;- Move files with script<br \/>\nls junk* | awk &#8216;{print &#8220;mv &#8220;$0&#8243; ..\/iraf\/&#8221;$0&#8243;.dat&#8221;}&#8217; | csh <\/p>\n<p>&#8212;- Using Nohup with sqlplus<br \/>\nnohup sqlplus username\/password @\/home\/sdmtest\/..sql name &amp;   &#8212;    the Output is in nohup.out<\/p>\n<p>&#8212; remove all empty lines from a file<br \/>\negrep -v &#8216;^$&#8217; nohup.out &gt; newfile.txt<\/p>\n<p>&#8212;- tr command<br \/>\n tr [-c] [-d] [-s] [string1] [string2]  output_file.txt<br \/>\n-c\tComplement the set of characters specified by string1.<br \/>\n-d\tDelete all occurrences of input characters that are specified by string1.<br \/>\n-s\tReplace instances of repeated characters with a single character.<br \/>\nstring1\tFirst string or character to be changed.<br \/>\nstring2\tSecond string or character to change the string1.<\/p>\n<p>tr -d &#8216;\\t&#8217;  newfile  &#8212; delete all Tabs from a File<\/p>\n<p>&#8212;- ls commands<br \/>\nls -lrt   &#8212; Shows sorted file output<\/p>\n<p>&#8212; show Variables value<br \/>\necho $variable Name &#8211; Shows the variable<br \/>\nset                 &#8211; list of all set Variabels<\/p>\n<p>&#8212;- Archivieren<br \/>\n tar -cf &#8211; file.dat | gzip -c &gt; blabla.tgz &#8212; file.dat will be archived in blabla.tgz<br \/>\n tar -cf &#8211; * | gzip -c &gt; blabla.tgz &#8212; all files from the Folder will be added to archive<\/p>\n<p>&#8211; Shows whats in Archive without unzip<br \/>\ngunzip -c blsbvs.tgz | tar tvf &#8211;<\/p>\n<p>&#8211; unzip only some files from archive<br \/>\ngunzip -c datejname | tar -xf &#8211; dateinamen mit pfad<\/p>\n<p>&#8211; better compression<br \/>\ncat file1 file2 | gzip &gt; foo.gz<\/p>\n<p>&#8211; list the contents of a tar.gz file<br \/>\ntar -ztvf file.tar.gz<br \/>\n# t: List the contents of an archive<br \/>\n# v: Verbosely list files processed (display detailed information)<br \/>\n# z: Filter the archive through gzip so that we can open compressed (decompress) .gz tar file<\/p>\n<p>&#8212;- delete recursively a folder with all elements in it<br \/>\nrm -r foldername<\/p>\n<p> &#8212; change owner<br \/>\nls -l  &#8211; see user &#8211; group<br \/>\nchown user:group filename<\/p>\n<p>&#8212; change file access rights<br \/>\nchmod u=rwx, g=rwx filename<br \/>\nchmod 777 filename<\/p>\n<p>&#8212;- Examples for regular expressions:<\/p>\n<p>#    smug         \t{search files for lines with &#8216;smug&#8217;}<br \/>\n#    &#8216;^smug&#8217;      \t{&#8216;smug&#8217; at the start of a line}<br \/>\n#    &#8216;smug$&#8217;      \t{&#8216;smug&#8217; at the end of a line}<br \/>\n#    &#8216;^smug$&#8217;     \t{lines containing only &#8216;smug&#8217;}<br \/>\n#    &#8216;\\^s&#8217;        \t{lines starting with &#8216;^s&#8217;, &#8220;\\&#8221; escapes the ^}<br \/>\n#    &#8216;[Ss]mug&#8217;    \t{search for &#8216;Smug&#8217; or &#8216;smug&#8217;}<br \/>\n#    &#8216;B[oO][bB]&#8217;  \t{search for BOB, Bob, BOb or BoB }<br \/>\n#    &#8216;^$&#8217;         \t{search for blank lines}<br \/>\n#    &#8216;[0-9][0-9]&#8217; \t{search for pairs of numeric digits}<br \/>\n#    &#8216;[a-zA-Z]&#8217;     \t{any line with at least one letter}<br \/>\n#    &#8216;[^a-zA-Z0-9]   {anything not a letter or number}<br \/>\n#    &#8216;[0-9]\\{3\\}-[0-9]\\{4\\}&#8217; \t{999-9999, like phone numbers}<br \/>\n#    &#8216;^.$&#8217;          \t{lines with exactly one character}<br \/>\n#    &#8216;&#8221;smug&#8221;&#8216;       \t{&#8216;smug&#8217; within double quotes}<br \/>\n#    &#8216;&#8221;*smug&#8221;*&#8217;     \t{&#8216;smug&#8217;, with or without quotes}<br \/>\n#    &#8216;^\\.&#8217;         \t{any line that starts with a Period &#8220;.&#8221;}<br \/>\n#    &#8216;^\\.[a-z][a-z]&#8217;\t{line start with &#8220;.&#8221; and 2 lc letters}<\/p>\n<p>&#8212;- Unix Commands list<br \/>\n<a href=\"http:\/\/www.computerhope.com\/unix.htm\" rel=\"nofollow\">http:\/\/www.computerhope.com\/unix.htm<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here is a list of some important shell commands: &#8212;- Using Screen command screen -ls &#8212; for a list of avaliable active screens screen -x &#8230;. &#8211; the Name from -ls output to join to this active screen Go out of the Screen with &#8216;ctrl a+d&#8217; without stopping it &#8212;- Harddisk and folder size df [&hellip;]<\/p>\n","protected":false},"author":65283547,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_wpcom_ai_launchpad_first_post":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"Important Shell script commands","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[559],"tags":[319,156755,312363,66653],"class_list":["post-55","post","type-post","status-publish","format-standard","hentry","category-others","tag-commands","tag-linux-commands","tag-shell-commands","tag-unix-commands"],"jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4CoHV-T","jetpack-related-posts":[],"jetpack_likes_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/vkrastev1blog.com\/wp-json\/wp\/v2\/posts\/55","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vkrastev1blog.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vkrastev1blog.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vkrastev1blog.com\/wp-json\/wp\/v2\/users\/65283547"}],"replies":[{"embeddable":true,"href":"https:\/\/vkrastev1blog.com\/wp-json\/wp\/v2\/comments?post=55"}],"version-history":[{"count":7,"href":"https:\/\/vkrastev1blog.com\/wp-json\/wp\/v2\/posts\/55\/revisions"}],"predecessor-version":[{"id":2819,"href":"https:\/\/vkrastev1blog.com\/wp-json\/wp\/v2\/posts\/55\/revisions\/2819"}],"wp:attachment":[{"href":"https:\/\/vkrastev1blog.com\/wp-json\/wp\/v2\/media?parent=55"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vkrastev1blog.com\/wp-json\/wp\/v2\/categories?post=55"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vkrastev1blog.com\/wp-json\/wp\/v2\/tags?post=55"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}