All commands (14,187)

  • You can try it . Nice shell interface to search google from the command line.Visit http://goosh.org in your browser. Show Sample Output


    -4
    http://goosh.org
    unixbhaskar · 2009-08-29 12:19:34 3
  • This command will reveal login has been made to the system as well as when the reboot occurs. It uses a file called /var/log/wtmp,which captures all the information about the successful login and reboot information. It has many switch ,by which you can get an idea when people login how long they stay. Show Sample Output


    -3
    last
    unixbhaskar · 2009-08-29 12:08:30 4
  • The important thing to note in this command, is the "-n" flag.


    10
    while read server; do ssh -n user@$server "command"; done < servers.txt
    sharfah · 2009-08-29 06:52:34 8
  • This is wonderful perl script to check the web server security and vulnerability .Get it from here :http://www.cirt.net/nikto2 Here are some key features of "Nikto": ? Uses rfp's LibWhisker as a base for all network funtionality ? Main scan database in CSV format for easy updates ? Determines "OK" vs "NOT FOUND" responses for each server, if possible ? Determines CGI directories for each server, if possible ? Switch HTTP versions as needed so that the server understands requests properly ? SSL Support (Unix with OpenSSL or maybe Windows with ActiveState's Perl/NetSSL) ? Output to file in plain text, HTML or CSV ? Generic and "server type" specific checks ? Plugin support (standard PERL) ? Checks for outdated server software ? Proxy support (with authentication) ? Host authentication (Basic) ? Watches for "bogus" OK responses ? Attempts to perform educated guesses for Authentication realms ? Captures/prints any Cookies received ? Mutate mode to "go fishing" on web servers for odd items ? Builds Mutate checks based on robots.txt entries (if present) ? Scan multiple ports on a target to find web servers (can integrate nmap for speed, if available) ? Multiple IDS evasion techniques ? Users can add a custom scan database ? Supports automatic code/check updates (with web access) ? Multiple host/port scanning (scan list files) ? Username guessing plugin via the cgiwrap program and Apache ~user methods Show Sample Output


    0
    nikto.pl -h yourwebserver
    unixbhaskar · 2009-08-29 04:54:43 8
  • Sometime you need to run firefox from the command just to rectify something about it.Means,if some of the addon broke you firefox setting or theme broke your ff setting then fall back to commandline i.e shell and type the mentioned command. It will open up an information box with few option along with the checkbox besides them(means you can select them) to start the web browser in safe mode.Besically deactivating all the addon and theme,except the default one.Once you are done/rectified thing ..close that session and reopen the browser normally.It should work.


    0
    firefox --safe-mode
    unixbhaskar · 2009-08-29 04:36:19 3
  • Once it is connected to the remote server by that ssh protocol,the mentioned command will start working on that server.


    -3
    ssh user@remotehost [anycommand](i.e uptime,w)
    unixbhaskar · 2009-08-29 04:27:37 7
  • If you follow my other posting regarding "vipw" and "vigr' then no explanation required.It has done the same thing as did with those two command.Open the /etc/sudoers file and attach a lock with it. Once you are done with it ,the lock gets released and the changes reflected to the original file.It will open a tmp file in vi editor to give you the chance to edit the sudoers file securely.visudo parses the sudoers file after the edit and will not save the changes if there is a syntax error. Upon finding an error, visudo will print a message stating the line number(s) where the error occurred and the user will receive the "What now?" prompt. At this point the user may enter "e" to re-edit the sudoers file, "x" to exit without saving the changes, or "Q" to quit and save changes. The "Q" option should be used with extreme care because if visudo believes there to be a parse error, so will sudo and no one will be able to sudo again until the error is fixed. If "e" is typed to edit the sudoers file after a parse error has been detected, the cursor will be placed on the line where the error occurred (if the editor supports this feature). PS: Although I have had experienced myself and few people shown to me that it behaves badly in some distribution ,noteably SLES.But the problem can be rectified with little caution. Show Sample Output


    -3
    visudo
    unixbhaskar · 2009-08-29 04:06:11 3
  • If you follow my previous posting regarding "vipw" then no explanation required.The same method goes behind this command also.It will open an tmp file in vi editor to give you the enlisting to edit the group file.And most importantly to attach a lock with it.Once you are done ,the lock is released and the changed reflected to the original file.So you can securely edit the group file over the network without the fear of being tampered . Show Sample Output


    -3
    vigr
    unixbhaskar · 2009-08-29 03:56:07 3
  • Now a bit of explanation required for this command.Once you type the command it opens up an vi editor with an temporary file enlisting the password file information .So if you make an change it will not reflected in the passwd file until you save the file.The reason behind using this command over other way to view the password file in network environment is that it locks the password file when you start working with it.So no one can temper with it during that period.Once you are done(means you save the tmp file) ,it will release the lock associated with it.I think it's a better mechanism to view the sensitive data like passwd file.Never ever use other tool like cat, nano or any other means. Show Sample Output


    -3
    vipw
    unixbhaskar · 2009-08-29 03:46:42 3
  • After you install slocate ,the first thing you have to do with it to initialise the database by issuing a command " slocate -u" . And then onwards just give the filename or dirname as a argument to the slocate command will reveal the files/dirs location in the system along with path.Moreover over it's an securely way of looking into the file system. Show Sample Output


    -3
    slocate filename/dirname
    unixbhaskar · 2009-08-29 03:28:08 3
  • Copy the link to an HD movie trailer in to this command. It's more eleganant if it's put in a to a script, taking the URL as input.


    5
    wget -U "QuickTime/7.6.2 (qtver=7.6.2;os=Windows NT 5.1Service Pack 3)" `echo http://movies.apple.com/movies/someHDmovie_720p.mov | sed 's/\([0-9][0-9]\)0p/h\10p/'`
    deadrabbit · 2009-08-29 00:29:40 21

  • 14
    rename -v 's/ /_/g' *
    fsilveira · 2009-08-28 17:28:57 7

  • 23
    tr : '\n' <<<$PATH
    foob4r · 2009-08-28 15:45:09 7
  • another method : awk '{gsub(/:/, "\n");print}' Show Sample Output


    1
    sed 's/:/\n/g' <<<$PATH
    twfcc · 2009-08-28 14:12:07 3
  • Compile *.c files with "gcc -Wall" in actual directory, using as output file the file name without extension.


    -7
    ls *.c | while read F; do gcc -Wall -o `echo $F | cut -d . -f 1 - ` $F; done
    pichinep · 2009-08-28 13:01:56 9

  • 13
    URL="http://www.google.com";curl -L --w "$URL\nDNS %{time_namelookup}s conn %{time_connect}s time %{time_total}s\nSpeed %{speed_download}bps Size %{size_download}bytes\n" -o/dev/null -s $URL
    adminix · 2009-08-28 12:30:56 8
  • First, we convert the VMware avi (VMnc format) to the Microsoft avi format. Next, we convert the Microsoft avi format to FLV format. You can play around with the -r switch (rate per second) and the -b switch (bitrate). But, if those get larger, so does your FLV file.


    0
    mencoder -of avi -ovc lavc movie.avi -o movie2.avi; ffmpeg -i movie2.avi -r 12 -b 100 movie.flv
    dcabanis · 2009-08-28 11:05:21 3

  • 0
    find . -type f -exec dos2unix {} +
    pavanlimo · 2009-08-28 08:44:11 6
  • It is a much better tool then nslookup for getting information about the any site.It has got better capability too.For reverse information please use the switch "-x" and the ip address. Show Sample Output


    -1
    dig google.com
    unixbhaskar · 2009-08-28 04:32:52 3
  • This is an commandline utility to get fair piece of information about the attached network card. Show Sample Output


    0
    ethtool eth0
    unixbhaskar · 2009-08-28 04:22:03 3
  • A wonderful command line utility to check the internet usage. It has got so many useful switch to display the data you want.Please visit the man page to get all the information.Get it from this website http://humdi.net/vnstat Show Sample Output


    0
    vnstat
    unixbhaskar · 2009-08-28 04:14:42 4
  • To get the connection information of protocol tcp and extended infortmation. Show Sample Output


    3
    sudo /bin/netstat -tpee
    unixbhaskar · 2009-08-28 04:02:10 5
  • As mentioned in the summery that it is a powerful command to monitor system activity in great way. It has got the power of vmstat,iostat,mpstat,df,free and sar.Instead of firing each single command separately ,one can fire one single command to get all the info at once.But there is a way to get the individual information too. Please see the man page . You can get it from here : http://dag.wieers.com/home-made/dstat/ Show Sample Output


    4
    dstat -afv
    unixbhaskar · 2009-08-28 03:53:24 9

  • -2
    du -s `find . -maxdepth 1 \! -name '.'` | sort -n | tail
    hydhaval · 2009-08-28 00:24:11 6
  • Of course you need to be able to access host A for this ;-)


    40
    ssh -t hostA ssh hostB
    0x89 · 2009-08-27 21:35:19 18
  • ‹ First  < 456 457 458 459 460 >  Last ›

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands


Check These Out

Convert seconds to [DD:][HH:]MM:SS
Converts any number of seconds into days, hours, minutes and seconds. sec2dhms() { declare -i SS="$1" D=$(( SS / 86400 )) H=$(( SS % 86400 / 3600 )) M=$(( SS % 3600 / 60 )) S=$(( SS % 60 )) [ "$D" -gt 0 ] && echo -n "${D}:" [ "$H" -gt 0 ] && printf "%02g:" "$H" printf "%02g:%02g\n" "$M" "$S" }

Visit wikileaks.com
Who needs a DNS server

resume other user's screen session via su, without pty error
Normally, if you su to another user from root and try to resume that other user's screen session, you will get an error like "Cannot open your terminal '/dev/pts/0' - please check." This is because the other user doesn't have permission for root's pty. You can get around this by running a "script" session as the new user, before trying to resume the screen session. Note you will have to execute each of the three commands separately, not all on the same line as shown here. Credit: I found this at http://www.hjackson.org/blog/archives/2008/11/29/cannot-open-your-terminal-dev-pts-please-check.

Place the NUM-th argument of the most recent command on the shell
After executing a command with multiple arguments like cp ./temp/test.sh ~/prog/ifdown.sh you can paste any argument of the previous command to the console, like ls -l ALT+1+. is equivalent to ls -l ./temp/test.sh ALT+0+. stands for command itself ('ls' in this case) Simple ALT+. cycles through last arguments of previous commands.

Get your external IP address without curl
Curl is not installed by default on many common distros anymore. wget always is :) $ wget -qO- ifconfig.me/ip

power off system in X hours form the current time, here X=2

awk date convert
Convert readable date/time with `date` command

Alias TAIL for automatic smart output
Run the alias command, then issue $ps aux | tail and resize your terminal window (putty/console/hyperterm/xterm/etc) then issue the same command and you'll understand. $ ${LINES:-`tput lines 2>/dev/null||echo -n 12`} Insructs the shell that if LINES is not set or null to use the output from `tput lines` ( ncurses based terminal access ) to get the number of lines in your terminal. But furthermore, in case that doesn't work either, it will default to using the default of 80. The default for TAIL is to output the last 10 lines, this alias changes the default to output the last x lines instead, where x is the number of lines currently displayed on your terminal - 7. The -7 is there so that the top line displayed is the command you ran that used TAIL, ie the prompt. Depending on whether your PS1 and/or PROMPT_COMMAND output more than 1 line (mine is 3) you will want to increase from -2. So with my prompt being the following, I need -7, or - 5 if I only want to display the commandline at the top. ( http://www.askapache.com/linux/bash-power-prompt.html ) 275MB/748MB [7995:7993 - 0:186] 06:26:49 Thu Apr 08 [askapache@n1-backbone5:/dev/pts/0 +1] ~ $ In most shells the LINES variable is created automatically at login and updated when the terminal is resized (28 linux, 23/20 others for SIGWINCH) to contain the number of vertical lines that can fit in your terminal window. Because the alias doesn't hard-code the current LINES but relys on the $LINES variable, this is a dynamic alias that will always work on a tty device.

generate a unique and secure password for every website that you login to
usage: sitepass MaStErPaSsWoRd example.com description: An admittedly excessive amount of hashing, but this will give you a pretty secure password, It also eliminates repeated characters and deletes itself from your command history. tr '!-~' 'P-~!-O' # this bit is rot47, kinda like rot13 but more nerdy rev # this avoids the first few bytes of gzip payload, and the magic bytes.

Route outbound SMTP connections through a addtional IP address rather than your primary


Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: