Facebook

Random scripts : Linux



1. setup a simple reminder to appear on your screen at a specific time
 
   $ echo 'xmessage "Hello"'|at 19:00
 
2. Its easy to move multiple files at once based on some criteria. 
    But moving all files except one is quit difficult. Here is a small combination 
    of commands which will enable you to do so.
 
Let your directory contains 4 files
 
 
to remove all but test4.txt, use below command ( -v flag with grep command)
 
   $ rm `ls | grep -v 4\.txt` 
 
result is - 
 
 
3. Get an excuse in one command


   $ echo `telnet bofh.jeffballard.us 666 2>/dev/null` |grep --color -o "Your excuse is:.*$"
 
 
 
 4. Generate 8 letter random password
 
      $ egrep -ioam1 '[a-z0-9]{8}' /dev/urandom 



5. Creating multiple files or directories
 
  $ touch test{1,2,3,4,5}.txt 
 
  $ mkdir  test{1,2,3,4,5} 


More to come soon... Happy learning.

https://www.facebook.com/Newbie.StayHungry
 

No comments:

Post a Comment