Most powerful examples of Unix commands or scripts every programmer should know

后端 未结 25 1466
遇见更好的自我
遇见更好的自我 2021-01-29 18:14

There are many things that all programmers should know, but I am particularly interested in the Unix/Linux commands that we should all know. For accomplishing tasks that we may

相关标签:
25条回答
  • 2021-01-29 18:34
    :() { :|: &} ;: 
    

    Fork Bomb without root access.

    Try it on your own risk.

    0 讨论(0)
  • 2021-01-29 18:35
    for card in `seq 1 8` ;do  
      for ts in `seq  1 31` ; do 
         echo $card $ts >>/etc/tuni.cfg;
       done
     done 
    

    was better than writing the silly 248 lines of config by hand.

    Neded to drop some leftover tables that all were prefixed with 'tmp'

    for table in `echo show tables | mysql quotiadb |grep ^tmp` ; do
      echo drop table $table
    done
    

    Review the output, rerun the loop and pipe it to mysql

    0 讨论(0)
  • 2021-01-29 18:37

    Grep (try Windows Grep)

    sed (try Sed for Windows)

    In fact, there's a great set of ports of really useful *nix commands available at http://gnuwin32.sourceforge.net/. If you have a *nix background and now use windows, you should probably check them out.

    0 讨论(0)
  • 2021-01-29 18:38
    • grep
    • awk
    • sed
    • perl
    • find

    A lot of Unix power comes from its ability to manipulate text files and filter data. Of course, you can get all of these commands for Windows. They are just not native in the OS, like they are in Unix.

    and the ability to chain commands together with pipes etc. This can create extremely powerful single lines of commands from simple functions.

    0 讨论(0)
  • 2021-01-29 18:38

    When solving problems on faulty linux boxes, by far the most common key sequence I type end up typing is alt+sysrq R E I S U B

    0 讨论(0)
  • 2021-01-29 18:39

    Sort of an aside, but you can get powershell on windows. Its really powerful and can do a lot of the *nix type stuff. One cool difference is that you work with .net objects instead of text which can be useful if you're using the pipeline for filtering etc.

    Alternatively, if you don't need the .NET integration, install Cygwin on the Windows box. (And add its directory to the Windows PATH.)

    0 讨论(0)
提交回复
热议问题