Learn about Centmin Mod LEMP Stack today
Register Now

Sysadmin [Howtoforge.com] Linux Commands - Overview and Examples

Discussion in 'System Administration' started by eva2000, Feb 1, 2018.

  1. eva2000

    eva2000 Administrator Staff Member

    36,055
    7,910
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,192
    Local Time:
    2:01 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    Linux SSH command line overview and examples Linux Commands - Overview and Examples :)

    Even I learnt some new commands i.e. expand and diff3 !

    diff3 compare 3 text files 1.txt, 2.txt, 3.txt contents
    Code (Text):
    cat 1.txt
    1
    2
    3
    

    Code (Text):
    cat 2.txt
    4
    5
    6
    

    Code (Text):
    cat 3.txt
    7
    8
    9
    

    Code (Text):
    diff3 1.txt 2.txt 3.txt
    ====
    1:1,3c
      1
      2
      3
    2:1,3c
      4
      5
      6
    3:1,3c
      7
      8
      9
    

    Code (Text):
    diff3 --help
    Usage: diff3 [OPTION]... MYFILE OLDFILE YOURFILE
    Compare three files line by line.
    
    Mandatory arguments to long options are mandatory for short options too.
      -A, --show-all              output all changes, bracketing conflicts
    
      -e, --ed                    output ed script incorporating changes
                                    from OLDFILE to YOURFILE into MYFILE
      -E, --show-overlap          like -e, but bracket conflicts
      -3, --easy-only             like -e, but incorporate only nonoverlapping changes
      -x, --overlap-only          like -e, but incorporate only overlapping changes
      -X                          like -x, but bracket conflicts
      -i                          append 'w' and 'q' commands to ed scripts
    
      -m, --merge                 output actual merged file, according to
                                    -A if no other options are given
    
      -a, --text                  treat all files as text
          --strip-trailing-cr     strip trailing carriage return on input
      -T, --initial-tab           make tabs line up by prepending a tab
          --diff-program=PROGRAM  use PROGRAM to compare files
      -L, --label=LABEL           use LABEL instead of file name
                                    (can be repeated up to three times)
    
          --help                  display this help and exit
      -v, --version               output version information and exit
    
    The default output format is a somewhat human-readable representation of
    the changes.
    
    The -e, -E, -x, -X (and corresponding long) options cause an ed script
    to be output instead of the default.
    
    Finally, the -m (--merge) option causes diff3 to do the merge internally
    and output the actual merged file.  For unusual input, this is more
    robust than using ed.
    
    If a FILE is '-', read standard input.
    Exit status is 0 if successful, 1 if conflicts, 2 if trouble.
    
    Report bugs to: [email protected]
    GNU diffutils home page: <http://www.gnu.org/software/diffutils/>
    General help using GNU software: <http://www.gnu.org/gethelp/>
    

     
    • Informative Informative x 1
  2. eva2000

    eva2000 Administrator Staff Member

    36,055
    7,910
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,192
    Local Time:
    2:01 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
  3. eva2000

    eva2000 Administrator Staff Member

    36,055
    7,910
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,192
    Local Time:
    2:01 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    Folks should definitely bookmark and read this linked guide if they want to be more familiar with SSH commands :)

    @sepulchre ;)
     
    • Like Like x 1
  4. JJC84

    JJC84 Premium Member Premium Member

    170
    74
    28
    Jan 31, 2018
    Ratings:
    +102
    Local Time:
    11:01 PM
    1.13.9
    10.1
    Thanks. I know there are many commands some common and some obscure that I still haven't mastered. I will bookmark this resource.
     
    • Like Like x 1
  5. Sanmayce

    Sanmayce New Member

    4
    1
    3
    Jun 9, 2018
    Sofia
    Ratings:
    +3
    Local Time:
    6:01 AM
    Allow me to jump in, what *nix utility can find "Sylvester Stallone" in the whole Wikipedia .XML dump (50+GB) when you supposedly don't know the correct name of the beloved actor and type "Silvestor Staloune"?

    When pattern searching is to be done, the first searcher that comes to my mind is the typhoon-class searcher Kazahana, especially in 2018 with wide-spreading of 16-threaded CPUs and in Q3 Threadripper 2 with its 32 core is incoming, so those enforced 16 threads come in handy :p
    My two dollars.
    [​IMG]
    The .C source and how to compile it with GCC:
    https://software.intel.com/sites/default/files/managed/12/85/Kazahana_2014-Dec-04.zip

    To compile 16-threaded ELF:
    Code:
    gcc -O3 -funroll-loops -static -o Kazahana_Hexadecad_GCC_472 Kazahana_r1-++fix+nowait_critical_nixFIX_WolfRAM+fixITER+EX+CS_fix_DEFINE.c -fopenmp -DCommence_OpenMP -D_FILE_OFFSET_BITS=64 -D_gcc_mumbo_jumbo_
    
    As a side note, the real men use high caliber "sustained firepower" guns, the gunpower is vital as in this paragon scene, cannot imagine for a moment using even M-16 or AK-47:
    [​IMG]
    How many people are able to see the common thread of Rambo's gun of choice and a text hitter!

    The quick showdown, grep (GNU grep) 3.1 (taken from latest MinGW\bin) vs Kazahana (compiled with GCC 4.7.2) on laptop with i5-7200u (2cores/4threads), the 65,865,333,874 bytes Wikipedia is accessed via USB 2.0 HDD:
    Code:
    C:\MinGW\bin>grep -V
    grep (GNU grep) 3.1
    Copyright (C) 2017 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    
    Written by Mike Haertel and others, see <http://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.
    
    D:\Kazahana>dir
    
    03/11/2018  01:34 PM    65,865,333,874 dumps.wikimedia.org_English_enwiki-20180220-pages-articles.xml
    02/25/2018  06:31 PM           784,384 grep.exe
    03/16/2018  03:15 PM           278,041 Kazahana_Hexadecad_GCC_472.exe
    07/16/2017  03:17 PM         1,005,288 Kazahana_r1-++fix+nowait_critical_nixFIX_WolfRAM+fixITER+EX+CS_fix_DEFINE.c
    03/16/2018  03:15 PM            94,300 pthreadGC2.dll
    03/16/2018  03:15 PM             6,144 timer64.exe
    
    C:\MinGW\bin>d:\kazahana\timer64.exe grep.exe "Sylvester Stalone" d:dumps.wikimedia.org_English_enwiki-20180220-pages-articles.xml
    Other international stars that have appeared in the show through the years are: [[Ricky Martin]], [[t.A.T.u.]], [[Will Smith]] (three times), [[Sylvester Stalone]], [[Arnold Schwarzenegger]], [[Kevin James]], [[Sylvia Saint]
    ], [[Diego Maradona]], [[Christina Aguilera]], [[David Copperfield (illusionist)|David Copperfield]], [[Drew Barrymore]], [[Cameron DA-az]], [[Lucy Liu]], [[Chris Rock]], [[Chayanne]], [[John Leguizamo]], [[N*SYNC]], The [[B
    ackstreet Boys]], [[Gloria Gaynor]], Shakira and [[Dwayne Johnson|The Rock]]. Worthy of note, although [[Paris Hilton]] was scheduled to appear on the show, she did not show up, leaving him to wait live in front of millions
    of viewers.
    In 2010, West Coast Customs designed three identical customized 1955 [[Ford F-100]] [[pick up truck]]&lt;nowiki/&gt;s which were prominently featured in the film ''[[The Expendables (2010 film)|The Expendables]]''.&lt;ref&gt
    ;{{Cite news|url=http://link.galegroup.com/apps/doc/A245542108/GPS?sid=wikipedia|title=The expendables' F-100: LMC truck teams up with West Coast customs for a wild ride|last=Mata, Jr.|first=John|date=23 August 2010|work=Tru
    ckin'|publisher=The Enthusiast Network|subscription=yes|access-date=22 January 2017|via=Gale (General OneFile)}}&lt;/ref&gt; One of these cars was for [[Sylvester Stalone]], who sold it at auction in 2011 for $132,000.&lt;re
    f&gt;{{Cite news|url=http://www.autoevolution.com/news/sylvester-stallone-s-expendables-truck-sells-for-132000-30195.html|title=Sylvester Stallone's &quot;Expendables&quot; Truck Sells for $132,000|last=Popa|first=Bogdan|dat
    e=25 January 2011|work=|newspaper=autoevolution|language=en-us|access-date=22 January 2017|via=}}&lt;/ref&gt; In 2015, WCC created a car by combining the body of a [[Ford Maverick]] and the internals of a [[Ford Ranger (Nort
    h America)|Ford Ranger]] for another film, ''[[Mad Max: Fury Road]]''.&lt;ref&gt;{{Cite news|url=http://www.autoevolution.com/news/west-coast-customs-made-a-magnum-opus-car-for-mad-max-game-and-its-apocalyptic-video-99460.ht
    ml|title=West Coast Customs Made a Magnum Opus Car for Mad Max Game, and Itâ?Ts Apocalyptic|last=Ungureanu|first=Ionut|date=1 September 2015|work=|newspaper=autoevolution|language=en-us|access-date=22 January 2017|via=}}&lt;
    /ref&gt;
        <title>Sylvester Stalone</title>
    And just incase you were wondering where Zachary gets his good looks from, well you will never know. His mystery is only exceeded by his power. Which he has alot of because he shares genes with Sylvester Stalone.
    :::I must have missed that. Still, it is in general very hard to catch the tracks from a camera dolley (or a camera itself for that matter) in a movie scene that has been edited and professionally produced. Perhaps the track
    s that are &quot;buried&quot; are simply the end of the streetcar lines (After all, running over [[Sylvester Stalone]] is generally bad. - [[User:AMP'd|AMP&amp;#39;d]] 03:19, 31 January 2007 (UTC)
    : I don't think Sylvester Stalone had the money to do bluescreen photography at that time. He was a poor young man. Moreover, Rocky played catch on the street with a local guy in that scene (Rocky was jogging, a guy threw an
     apple to Rocky, Rocky got the apple ...). It was unneeded and next to impossible for Sylvester Stalone to film that part with bluescreen.
    and it is the Embassy of Paraguy, as I purchased the right for it to be the Embassy of Panama ( I purchased this as an Embassy of my foster father Richard Dreyfuss as a suprise, and foster mother Marcia Clark the property ha
    s a code which is the MArriage Certificate between I and Ann Convertino of Gateways Hospital and Mental Health Center Los Angeles( The Vatican have the means to interpet the code, and Sylvester Stalone who didnot want us to
    be married has the interpreter, as well as Sharon Stone), and the persons who hit me with a board in my yard when I lived at 40635 159 th street East are paraguy, that essentially betrayed me as Deutshe Bank trust Company Am
    erica employees,
    :Collect, ''why'' is it likely to be a contentious claim when the sources we're using list '''all''' or '''most''' of the porn films the named actor has appeared in and not just &quot;'''a''' porn film&quot;? It's not like w
    e are trying to include [[Sylvester Stalone]] or [[Kristine DeBell]] from [[Meatballs (film)]] in a list of porn actors because they were in a single film. These are people who have clearly chosen to be in the Industry. --[[
    User:Scalhotrod|Scalhotrod - Just your average banjo playing, drag racing, cowboy...]] ([[User talk:Scalhotrod|talk]]) 23:54, 29 December 2013 (UTC)
    Looking forward, as Kummen accepts more adult roles, he has expressed interest in playing roles that might be more on the dark side, including that of a serial killerâ?"perhaps along the lines of Norman in [[Bates Motel (TV
    series)|Bates Motel]] or [[Psycho (1960 film)|Psycho]].&lt;ref&gt;{{cite web|last1=Fuller|first1=Gary|title=Telephone Conversation with Mitchell Kummen, 26 March 2017}}&lt;/ref&gt; Kummen has also expressed interest in worki
    ng with [[Jackie Chan]], [[Johnny Depp]], [[Brad Pitt]], [[Leonardo DiCaprio]], [[Sylvester Stalone]], [[Mark Wahlberg]], and [[Denzel Washington]].&lt;ref name=&quot;SFP&quot;&gt; {{cite web|last1=Cullen|first1=Ian|title=SF
    P-Now Featuring Mitchell Kummen|url=https://itunes.apple.com/us/podcast/scifipulse-radio/id655617877?mt=2/|website=iTunes (#32)|publisher=SciFiPulse Radio|accessdate=4 April 2017}}&lt;/ref&gt;
    Raspberry Blood and Oscar247 both edited Sylvester Stalone, though years apart.
    
    Kernel  Time =    75.250 =    4%
    User    Time =   441.906 =   23%
    Process Time =   517.156 =   27%    Virtual  Memory =      5 MB
    Global  Time =  1865.139 =  100%    Physical Memory =      7 MB
    
    D:\Kazahana>timer64.exe Kazahana_Hexadecad_GCC_472.exe "Sylvester Stalone" dumps.wikimedia.org_English_enwiki-20180220-pages-articles.xml 19263
    Kazahana, a superfast exact & wildcards & Levenshtein Distance (Wagner-Fischer) searcher, r. 1-++fix+nowait_critical_nixFIX_Wolfram+fixITER+EX+CS_fix_DEFINE, copyleft Kaze 2014-Dec-04.
    Pattern: Sylvester Stalone
    omp_get_num_procs( ) = 4
    omp_get_max_threads( ) = 4
    Enforcing HEXADECAD i.e. hexadecuple-threads ...
    Allocating Master-Buffer 19263KB ... OK
    -; Speed: 00,000,037,533 bytes/clock; Traversed: 65,859,154,949 bytes
    Kazahana: Dumped xgrams: 10
    Kazahana: Performance: 36 KB/clock
    Kazahana: Performance: Total/fread() clocks: 1,755,197/1,734,545
    Kazahana: Performance: I/O time, i.e. fread() time, is 98 percents
    Kazahana: Done.
    
    Kernel  Time =   115.265 =    6%
    User    Time =    58.375 =    3%
    Process Time =   173.640 =    9%    Virtual  Memory =     22 MB
    Global  Time =  1756.361 =  100%    Physical Memory =     24 MB
    
    D:\Kazahana>type Kazahana.txt
    Other international stars that have appeared in the show through the years are: [[Ricky Martin]], [[t.A.T.u.]], [[Will Smith]] (three times), [[Sylvester Stalone]], [[Arnold Schwarzenegger]], [[Kevin James]], [[Sylvia Saint]
    ], [[Diego Maradona]], [[Christina Aguilera]], [[David Copperfield (illusionist)|David Copperfield]], [[Drew Barrymore]], [[Cameron Díaz]], [[Lucy Liu]], [[Chris Rock]], [[Chayanne]], [[John Leguizamo]], [[N*SYNC]], The [[B
    ackstreet Boys]], [[Gloria Gaynor]], Shakira and [[Dwayne Johnson|The Rock]]. Worthy of note, although [[Paris Hilton]] was scheduled to appear on the show, she did not show up, leaving him to wait live in front of millions
    of viewers.
    In 2010, West Coast Customs designed three identical customized 1955 [[Ford F-100]] [[pick up truck]]&lt;nowiki/&gt;s which were prominently featured in the film ''[[The Expendables (2010 film)|The Expendables]]''.&lt;ref&gt
    ;{{Cite news|url=http://link.galegroup.com/apps/doc/A245542108/GPS?sid=wikipedia|title=The expendables' F-100: LMC truck teams up with West Coast customs for a wild ride|last=Mata, Jr.|first=John|date=23 August 2010|work=Tru
    ckin'|publisher=The Enthusiast Network|subscription=yes|access-date=22 January 2017|via=Gale (General OneFile)}}&lt;/ref&gt; One of these cars was for [[Sylvester Stalone]], who sold it at auction in 2011 for $132,000.&lt;re
    f&gt;{{Cite news|url=http://www.autoevolution.com/news/sylvester-stallone-s-expendables-truck-sells-for-132000-30195.html|title=Sylvester Stallone's &quot;Expendables&quot; Truck Sells for $132,000|last=Popa|first=Bogdan|dat
    e=25 January 2011|work=|newspaper=autoevolution|language=en-us|access-date=22 January 2017|via=}}&lt;/ref&gt; In 2015, WCC created a car by combining the body of a [[Ford Maverick]] and the internals of a [[Ford Ranger (Nort
    h America)|Ford Ranger]] for another film, ''[[Mad Max: Fury Road]]''.&lt;ref&gt;{{Cite news|url=http://www.autoevolution.com/news/west-coast-customs-made-a-magnum-opus-car-for-mad-max-game-and-its-apocalyptic-video-99460.ht
    ml|title=West Coast Customs Made a Magnum Opus Car for Mad Max Game, and ItΓÇÖs Apocalyptic|last=Ungureanu|first=Ionut|date=1 September 2015|work=|newspaper=autoevolution|language=en-us|access-date=22 January 2017|via=}}&lt;
    /ref&gt;
        <title>Sylvester Stalone</title>
    And just incase you were wondering where Zachary gets his good looks from, well you will never know. His mystery is only exceeded by his power. Which he has alot of because he shares genes with Sylvester Stalone.
    :::I must have missed that. Still, it is in general very hard to catch the tracks from a camera dolley (or a camera itself for that matter) in a movie scene that has been edited and professionally produced. Perhaps the track
    s that are &quot;buried&quot; are simply the end of the streetcar lines (After all, running over [[Sylvester Stalone]] is generally bad. - [[User:AMP'd|AMP&amp;#39;d]] 03:19, 31 January 2007 (UTC)
    : I don't think Sylvester Stalone had the money to do bluescreen photography at that time. He was a poor young man. Moreover, Rocky played catch on the street with a local guy in that scene (Rocky was jogging, a guy threw an
     apple to Rocky, Rocky got the apple ...). It was unneeded and next to impossible for Sylvester Stalone to film that part with bluescreen.
    and it is the Embassy of Paraguy, as I purchased the right for it to be the Embassy of Panama ( I purchased this as an Embassy of my foster father Richard Dreyfuss as a suprise, and foster mother Marcia Clark the property ha
    s a code which is the MArriage Certificate between I and Ann Convertino of Gateways Hospital and Mental Health Center Los Angeles( The Vatican have the means to interpet the code, and Sylvester Stalone who didnot want us to
    be married has the interpreter, as well as Sharon Stone), and the persons who hit me with a board in my yard when I lived at 40635 159 th street East are paraguy, that essentially betrayed me as Deutshe Bank trust Company Am
    erica employees,
    :Collect, ''why'' is it likely to be a contentious claim when the sources we're using list '''all''' or '''most''' of the porn films the named actor has appeared in and not just &quot;'''a''' porn film&quot;? It's not like w
    e are trying to include [[Sylvester Stalone]] or [[Kristine DeBell]] from [[Meatballs (film)]] in a list of porn actors because they were in a single film. These are people who have clearly chosen to be in the Industry. --[[
    User:Scalhotrod|Scalhotrod - Just your average banjo playing, drag racing, cowboy...]] ([[User talk:Scalhotrod|talk]]) 23:54, 29 December 2013 (UTC)
    Looking forward, as Kummen accepts more adult roles, he has expressed interest in playing roles that might be more on the dark side, including that of a serial killerΓÇöperhaps along the lines of Norman in [[Bates Motel (TV
    series)|Bates Motel]] or [[Psycho (1960 film)|Psycho]].&lt;ref&gt;{{cite web|last1=Fuller|first1=Gary|title=Telephone Conversation with Mitchell Kummen, 26 March 2017}}&lt;/ref&gt; Kummen has also expressed interest in worki
    ng with [[Jackie Chan]], [[Johnny Depp]], [[Brad Pitt]], [[Leonardo DiCaprio]], [[Sylvester Stalone]], [[Mark Wahlberg]], and [[Denzel Washington]].&lt;ref name=&quot;SFP&quot;&gt; {{cite web|last1=Cullen|first1=Ian|title=SF
    P-Now Featuring Mitchell Kummen|url=https://itunes.apple.com/us/podcast/scifipulse-radio/id655617877?mt=2/|website=iTunes (#32)|publisher=SciFiPulse Radio|accessdate=4 April 2017}}&lt;/ref&gt;
    Raspberry Blood and Oscar247 both edited Sylvester Stalone, though years apart.
    
    D:\Kazahana>
    
    Hm, 4 years later, Wikimedia staff did not correct the misspelled name?!
    Usually, Kazahana is 2x to 4x faster than grep, inhere only 1865-1756=109 seconds, the culprit being the external HDD, on modern SSDs with 3000MB/s burst reads I fully expect the 4x quickness to surface.
     
    Last edited: Jun 10, 2018
    • Informative Informative x 1
  6. eva2000

    eva2000 Administrator Staff Member

    36,055
    7,910
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,192
    Local Time:
    2:01 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    interesting never heard of kazahana
     
..