
Terminal - Commands using seq - 83 results
for times in $(seq 10) ; do puppet agent -t && break ; done
This is sample output - yours may be different.
The example runs 'puppet' in a loop for 10 times, but exits the loop before if it returns 0 (that means "no changes on last run" for puppet).
for a in $(seq 5 8); do cat twit.txt | cut -d " " -f$a | grep "^@" | sort -u; done > followlst.txt
This is sample output - yours may be different.
Go to "https://twitter.com/search/realtime?q=%23TeamFollowBack&src=hash" and then copy al the text on the page. If you scroll down the page will be bigger. Then put al the text in a text file called twit.txt
If you follow the user there is a high probability the users give you follow back.
To follow all the users you can use an iMacros script.
for i in $(seq -w 0 100) ; do mv prefix$(( 10#$i )).jpg prefix${i}.jpg ; done
This is sample output - yours may be different.
for count in $(seq 2 1001); do say "$count sheeps";sleep 2;done
This is sample output - yours may be different.
for count in $(seq 2 1001); do espeak "$count sheeps";sleep 2;done
This is sample output - yours may be different.
for code in $(seq -w 0 255); do for attr in 0 1; do printf "%s-%03s %bTest%b\n" "${attr}" "${code}" "\e[${attr};38;05;${code}m" "\e[m"; done; done | column -c $((COLUMNS*2))
This is sample output - yours may be different.
Shows the ?rendering? for each of the 256 colours in both the bold and normal variant. Using seq is helpful to get even lines, passing $((COLUMNS*2)) to column sort-of-handles the nonprintable characters.
This is sample output - yours may be different.
Above command will generate a random number between 1 to 10.
seq 2 100 | factor | sed '/ .* / d ; s/:.*//'
This is sample output - yours may be different.
for i in $(seq 1 100 | sort -R); do echo $i; sleep 5; done
This is sample output - yours may be different.
Random choose numbers from 1 to 100 with 5 seconds interval without duplicates.
SUBNET="192.168.41" ; diff -y <(nmap -sP -n ${SUBNET}.0/24 | grep ${SUBNET}. | awk '{print $5}' | sort -t"." -k4 -n) <(for i in $(seq 1 254); do echo ${SUBNET}.$i; done)
This is sample output - yours may be different.
192.168.41.1 192.168.41.1
> 192.168.41.2
> 192.168.41.3
192.168.41.4 192.168.41.4
192.168.41.5 192.168.41.5
192.168.41.6 192.168.41.6
192.168.41.7 192.168.41.7
192.168.41.8 192.168.41.8
> 192.168.41.9
> 192.168.41.10
192.168.41.11 192.168.41.11
The command will make it easy to determine free IP ranges in a crowded sub-net.
case `uname` in FreeBSD)a=$#; case $a in 2) case $1 in 0) jot $(($2+1)) 0 $2 ;; *) jot $2 $1 $2 ;;esac;esac;esac; # usage: seq 1 4; seq 0 4
This is sample output - yours may be different.
seq 1 5 | xargs -I"#" date --date="today -# days" +'%Y-%m-%d'
This is sample output - yours may be different.
zeros=3; from=1; to=15; for foo in $(seq $from $to); do echo mv "front${foo}back" "front$(printf "%0${zeros}d\n" $foo)back"; done
This is sample output - yours may be different.
mv front1back front001back
mv front2back front002back
mv front3back front003back
mv front4back front004back
mv front5back front005back
mv front6back front006back
mv front7back front007back
mv front8back front008back
mv front9back front009back
mv front10back front010back
mv front11back front011back
mv front12back front012back
mv front13back front013back
mv front14back front014back
mv front15back front015back
This command takes a few changes to get to the file format, but once you have that, you're good to go. Set your environment variables and then change the text "front" and "back" to whatever you're files start and end with. You'll end up with some easily sort-able files.
up() { local x='';for i in $(seq ${1:-1});do x="$x../"; done;cd $x; }
This is sample output - yours may be different.
Add this to your .BASHRC file and you can simply type up to cd back one directory, up 2 to cd twice, up 10 to cd ten times... better then b,bb,bbb,bbbb aliases
I wrote this a long time ago, wondering why this wasn't floating around somewhere out there (at least not where I could find).. this seems much more simple than multiple aliases and can cd out of directories easier.
up () { if [ "${1/[^0-9]/}" == "$1" ]; then p=./; for i in $(seq 1 $1); do p=${p}../; done; cd $p; else echo 'usage: up N'; fi }
This is sample output - yours may be different.
/home/someone/directory$ up
/home/someone$ up 2
/$ cd -
/home/someone$
Change n directories up, without parameters change one up
paste <(seq 7 | shuf | tr 1-7 A-G) <(seq 7 | shuf) | while read i j; do play -qn synth 1 pluck $i synth 1 pluck mix $2; done
This is sample output - yours may be different.
seq -f 'echo %g' $NUM | sh
This is sample output - yours may be different.
$ seq -f 'echo %g' 10 | sh
1
2
3
4
5
6
7
8
9
10
shorter loop than for loop
seq -f 'echo %g' $NUM | sh
for i in {0..$NUM}; do echo $i done
seq 1 1000000 | while read i; do echo -en "\r$i"; done
This is sample output - yours may be different.
for i in $(seq 1 20); do while read line; do echo "$i: $line"; done<$i.py; done
This is sample output - yours may be different.
for i in $(seq 1 `curl http://megatokyo.com 2>/dev/null|grep current|cut -f6 -d\"`);do wget http://megatokyo.com/`curl http://megatokyo.com/strip/${i} 2>/dev/null|grep src=\"strips\/|cut -f4 -d\"`;done
This is sample output - yours may be different.
A simple script for download all the MegaTokyo strips from the first to the last one
pktsize=1516;for i in $( seq $pktsize -8 1450 ) ; do ping -M do -s $i -c 1 slashdot.org; done
This is sample output - yours may be different.
PING slashdot.org (216.34.181.45) 1516(1544) bytes of data.
From wombat.local (192.168.55.10) icmp_seq=1 Frag needed and DF set (mtu = 1500)
--- slashdot.org ping statistics ---
0 packets transmitted, 0 received, +1 errors
... eventually, note Max pkt .....vvvv that can be sent unsplit
PING slashdot.org (216.34.181.45) 1460(1488) bytes of data.
1468 bytes from slashdot.org (216.34.181.45): icmp_req=1 ttl=244 time=95.1 ms
--- slashdot.org ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 95.137/95.137/95.137/0.000 ms
Linux - starting with a packetsize that must be split into two packets, count down by 8 bytes, and try to send the packet using the "Don't Fragment" option. The actual MTU (the size of the actual PING packet) is (in this example) 1460 data bytes + 20 bytes IP header + 8 bytes PING request = 1488
sayspeed() { for i in $(seq 1 `echo "$1"|wc -c`); do echo -n "`echo $1 |cut -c ${i}`"; sleep 0.1s; done; echo "";}
This is sample output - yours may be different.
sayspeed "Who are you?"
Who are you?
----
sayspeed "Loading..."
Loading...
change the time that you would like to have as print interval
and just use it to say whatever you want to
enscript -L1 -b'||Page $% of $=' -o- < <(for i in $(seq "$(pdftk "$1" dump_data | grep "Num" | cut -d":" -f2)"); do echo; done) | ps2pdf - | pdftk "$1" multistamp - output "${1%.pdf}-header.pdf"
This is sample output - yours may be different.
Put this code in a bash script. The script expects the PDF file as its only parameter.
It will add a header to the PDF containing the page numbers and output it to a file with the suffix "-header.pdf"
Requires enscript, ps2pdf and pdftk.
genRandomText() { a=( a b c d e f g h i j k l m n o p q r s t u v w x y z );f=0;for i in $(seq 1 $(($1-1))); do r=$(($RANDOM%26)); if [ "$f" -eq 1 -a $(($r%$i)) -eq 0 ]; then echo -n " ";f=0;continue; else f=1;fi;echo -n ${a[$r]};done;echo"";}
This is sample output - yours may be different.
[bbbco ~]$ genRandomText 122
onzwxfeknlnvycuccvki dybtrqibdpgl aeclwkfpuxkohucy cqlmpbkwgcqesimxupdkqiymucljhitffb czegujyofidnxnvrkolhmudslpklbjnpmun
[bbbco ~]$ genRandomText 122 | wc -m
122
[bbbco ~]$ genRandomText 27
b bpglferrcsrtveiop umn nq
[bbbco ~]$ genRandomText 27 | wc -m
27
Ever need to get some text that is a specific number of characters long? Use this function to easily generate it! Doesn't look pretty, but sure does work for testing purposes!
comm -13 <(od -vw1 -tu1 dummy.txt|cut -c9-|sort -u) <(seq 0 127|sort)|perl -pe '$_=chr($_)'|od -c
This is sample output - yours may be different.
0000000 \0 001 \n j k \v \f z { | } ~ 177 \r 016 017
0000020 020 021 022 023 002 024 025 026 027 030 031 032 033 034 035 003
0000040 036 037 ! " # $ % & ' 004 ( ) * + ,
0000060 - . / 0 1 005 2 3 4 5 6 7 8 9 : ;
0000100 006 < = > ? @ A B C D E \a F G H I
0000120 J K L M N O \b P Q R S T U V W X
0000140 Y \t Z [ \ ] ^ _ ` a b c
0000154
Search in decimal rather than hex. od dumps the character list, cut to remove offsets, sort -u gives the used characters. seq gives the comparison list, but we need this sorted alphabetically for comm, which does the filtering. I drop to perl to convert back to characters (is there a better way?) and then use od to dump them in a print-safe format.