Posts Tagged With: cli

Database Data to Download Variables

Tagged with: , , , ,

Gets data from a MySql database, splits the data into separate columns, then uses one column in a URL to download something – and uses other column to name the file thats downloaded

for i in $(mysql -u root Project_Madapp -sNe 'SELECT CONCAT(id,",",name) AS yo FROM City WHERE type="actual"'); do parts=(${i//,/ }); wget -O "${parts[1]}.csv" "http://localhost/student_allocation_csv.php?format=csv&city_id=${parts[0]}"; done

1 Comment »

Search Wikipedia from Command Line

Tagged with: , , ,

Get the intro paragraph of any wikipedia article using this trick…

dig +short txt "<keyword>".wp.dg.cx
3 Comments »

top in Batch Mode

Tagged with: , , , , ,

Run top in batch mode


top -b -d 10 -n 3
No Comments »

Post a new Task to Nexty

Tagged with: , , , , , , ,

This is the command used to post a new task to the nexty GTD tool.


curl --basic --user "binnyva:password" --cookie-jar /tmp/nexty-cookies.txt --data-ascii "task=`echo $@|tr ' ' '+'`&layout=cli" "http://nexty.org/tasks/add.php"
No Comments »

Post To Identi.ca using Curl

Tagged with: , , , , , , ,

Post a status update to identi.ca using just curl


curl --basic --user binnyva:PASSWORD --data-ascii "status=The new status goes here" http://identi.ca/api/statuses/update.xml
No Comments »

Create a Directory Tree in One Command

Tagged with: , , , , , ,

You can create a directory tree using just one command in Linux


mkdir -p /tmp/dir1/dir2
No Comments »

Using Range in Commands

Tagged with: , , , , ,

Show files and directory containing numbers


ls *[0-9]*
No Comments »

Commands for Idle Time

Tagged with: , , , ,

I run this command when I go for lunch or something – these commands take a while to run.


sudo /bin/bash /usr/sbin/makewhatis -w; sudo /usr/bin/updatedb; sudo /home/binnyva/Software/System/chkrootkit-0.47/chkrootkit
No Comments »

lsmod – Show Loaded Kernel Modules

Tagged with: , , , , ,

This command shows the kernel modules that are currently loaded.


# lsmod

Module                  Size  Used by
vboxdrv                55088  0
autofs4                20421  2
ipt_MASQUERADE          6721  1
iptable_nat             9669  1
nf_nat                 18669  2 ipt_MASQUERADE,iptable_nat
nf_conntrack_ipv4      11717  2 iptable_nat
nf_conntrack           51977  4 ipt_MASQUERADE,iptable_nat,nf_nat,nf_conntrack_ipv4
....
No Comments »

Show Disk Usage – du

Tagged with: , , , , , ,

du shows the ‘disk usage’ – the space taken up by the files and folders in the current directory.


du -bh | more
No Comments »