Commands tagged scanner (7)

  • Simple one-liner for scanning a range of hosts, you can also scan a range of ports with Netcat by ex.: nc -v -n -z -w 1 192.168.0.1 21-443 Useful when Nmap is not available:) Range declaration like X..X "for i in {21..29}" is only works with bash 3.0+ Show Sample Output


    9
    for i in {21..29}; do nc -v -n -z -w 1 192.168.0.$i 443; done
    rez0r · 2009-09-25 03:31:29 12
  • Joins two pdf documents coming from a simplex document feed scanner. Needs pdftk >1.44 w/ shuffle.


    5
    pdftk A=odd.pdf B=even.pdf shuffle A1-end Bend-1S output duplex.pdf
    till · 2011-02-25 15:00:09 6
  • Very handy way to perform a host scan if you don't have nmap,ncat,nc ...or other tools installed locally. When executing a command on a /dev/tcp/$host/$port pseudo-device file, Bash opens a TCP connection to the associated socket and UDP connection when using /dev/udp/$host/$port.A simlpe way to get servers banner is to run this command "cat < /dev/tcp/localhost/25" , here you will get mail server's banner. NOTE: Bash, as packaged for Debian, does not support using the /dev/tcp and /dev/udp pseudo-device it's not enabled by default Because bash in Debian is compiled with ?disable-net-redirections. Show Sample Output


    4
    for p in {1..1023}; do(echo >/dev/tcp/localhost/$p) >/dev/null 2>&1 && echo "$p open"; done
    benyounes · 2010-04-26 18:09:22 41
  • Xsane produces PDFs that are too large - particularly multipage PDFs. This command compresses them. If you do not use A4, remove the -sPAPERSIZE flag.


    3
    gs -q -sPAPERSIZE=a4 -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=test.pdf multipageproject.pdf
    iain · 2009-03-24 17:14:46 9
  • Adjust the --resolution and --mode as required (if these options are available for your scanner). The size options (-x, -y, -imageheight, -imagewidth) are for US letter paper. For A4, I think the command would be: scanimage -p --resolution 250 --mode Gray -x 210 -y 297 | pnmtops -imageheight 11.7 -imagewidth 8.3 | ps2pdf - output.pdf


    3
    scanimage -p --resolution 250 --mode Gray -x 215.9 -y 279.4 | pnmtops -imageheight 11 -imagewidth 8.5 | ps2pdf - output.pdf
    dbh · 2013-04-12 18:18:42 12
  • use imagemagik convert


    2
    convert -compress jpeg *.jpg mydoc.pdf
    hute37 · 2011-05-01 13:37:09 4
  • Does a ping scan on the local subnet and returns the IPs that are up Show Sample Output


    0
    nmap -T4 -sn 192.168.1.0/24
    drewbled · 2012-06-19 17:07:24 3

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

Sort lines using the Xth characted as the start of the sort string
Tells sort to ignore all characters before the Xth position in the first field per line. If you have a list of items one per line and want to ignore the first two characters for sorting purposes, you would type "sort -k1.3". Change the "1" to change the field being sorted. The decimal value is the offset in the specified field to sort by.

Extract title from HTML files
This command can be used to extract the title defined in HTML pages

Install pip with Proxy
Installs pip packages defining a proxy

Bash prompt with user name, host, history number, current dir and just a touch of color
I put that line in my .bash_profile (OS X) and .bashrc (Linux). Here is a summary of what the \char means: n=new line, u=user name, h=host, !=history number, w=current work directory The \[\e[32m\] sequence set the text to bright green and \[\e[0m\] returns to normal color. For more information on what you can set in your bash prompt, google 'bash prompt'

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

Create a file of a given size in linux
If you're trying to create a sparse file, you can use dd by 'skip'ing to the last block instance. ls -ls shows the actual size vs. the reported size

Make vim open in tabs by default (save to .profile)
I always add this to my .profile rc so I can do things like: "vim *.c" and the files are opened in tabs.

Monitoring file handles used by a particular process
-r : repeat mode

Create a mirror of a local folder, on a remote server
Create a exact mirror of the local folder "/root/files", on remote server 'remote_server' using SSH command (listening on port 22) (all files & folders on destination server/folder will be deleted)

swap stdout and stderr
Possible use, to filter something in stderr: (/usr/bin/$COMMAND $PARAM 3>&1 1>&2 2>&3 | grep -v $uninteresting_error ) 3>&1 1>&2 2>&3


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: