Post your Command line tricks

Forum rules
Share your brain ;)
machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Post your Command line tricks

Unread post by machinebacon » Sun May 03, 2015 9:02 pm

because it's a builtin, yup :)
..gnutella..

User avatar
stark
MILF
Posts: 521
Joined: Sat Sep 27, 2014 6:38 pm
Location: Arpanet
Contact:

Re: Post your Command line tricks

Unread post by stark » Sun May 10, 2015 1:58 pm

If you can do it go ahead and do it, if you can't do it then don't even criticize it. - gingerdesu

User avatar
wuxmedia
Grasshopper
Posts: 6445
Joined: Wed Oct 17, 2012 11:32 am
Location: Back in Blighty
Contact:

Re: Post your Command line tricks

Unread post by wuxmedia » Sun May 10, 2015 3:54 pm

now that looks nice, need to get my vim on now :)
Thanks stark !
"Seek, and Ye shall find"
"Github | Chooons | Site"

User avatar
wuxmedia
Grasshopper
Posts: 6445
Joined: Wed Oct 17, 2012 11:32 am
Location: Back in Blighty
Contact:

Re: Post your Command line tricks

Unread post by wuxmedia » Thu Jun 11, 2015 11:42 am

one I learnt today:

Code: Select all

update-rc.d -f <service> remove
To prevent boot up of certain things.
"Seek, and Ye shall find"
"Github | Chooons | Site"

User avatar
dkeg
Configurator
Posts: 3782
Joined: Sun Nov 18, 2012 9:23 pm
Location: Mid-Atlantic Grill

Re: Post your Command line tricks

Unread post by dkeg » Thu Jun 11, 2015 12:02 pm

nice, I didn't know that. I used chkconfig for that. I'm using openrc now, where you can perform similar actions

Code: Select all

rc-update [add|remove] <service> [runlevel]

Work hard; Complain less

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Post your Command line tricks

Unread post by machinebacon » Wed Jun 17, 2015 2:50 pm

Code: Select all

dpkg-query -W --showformat='${Installed-Size;10}\t${Package}\n' | sort -k1,1n
show the list of installed packages sorted by size
..gnutella..

User avatar
Dr_Chroot
Alfalfa
Posts: 1100
Joined: Mon Jun 09, 2014 9:49 pm
Location: among the sagebrush
Contact:

Re: Post your Command line tricks

Unread post by Dr_Chroot » Wed Jun 17, 2015 6:04 pm

^ This is fantastic. Set as a bash alias :)
Fight internet censorship.
EFF | Tor Project | Bitcoin

"There have been times throughout American history where what is right is not the same as what is legal. Sometimes to do the right thing you have to break the law." - Edward Snowden

User avatar
elixir
Weight Watcher
Posts: 357
Joined: Fri Feb 21, 2014 8:25 am

Re: Post your Command line tricks

Unread post by elixir » Wed Jun 17, 2015 7:49 pm

^^ Thanks for the share, Sir Bacon. I, too, have this as an alias now :)
Out of the corner of your eye you spot him... Shia LaBeouf.

https://www.youtube.com/watch?v=o0u4M6vppCI

User avatar
Dr_Chroot
Alfalfa
Posts: 1100
Joined: Mon Jun 09, 2014 9:49 pm
Location: among the sagebrush
Contact:

Re: Post your Command line tricks

Unread post by Dr_Chroot » Wed Jun 17, 2015 10:46 pm

Fight internet censorship.
EFF | Tor Project | Bitcoin

"There have been times throughout American history where what is right is not the same as what is legal. Sometimes to do the right thing you have to break the law." - Edward Snowden

User avatar
simgin
Meme Fodder
Posts: 1167
Joined: Sun Jan 06, 2013 12:07 am
Location: Bradford-on-Avon, UK

Re: Post your Command line tricks

Unread post by simgin » Thu Jun 18, 2015 5:22 pm

Julius, you are the BASH script king :)
cheers
simon
Someone told me that I am delusional, I almost fell off my unicorn.

User avatar
stark
MILF
Posts: 521
Joined: Sat Sep 27, 2014 6:38 pm
Location: Arpanet
Contact:

Re: Post your Command line tricks

Unread post by stark » Sat Jul 11, 2015 4:15 pm

So after a bit of a struggle I cleaned up my ~/.bashrc :D

Thanks to dkeg for suggesting me previously to use the absolute path ( i.e. /home/stark/ ) which also flawlessly works.

Code: Select all

profile="$HOME/.profile"
shell_aliases="$HOME/etc/shell/bash/aliases.bash"
shell_functions="$HOME/etc/shell/bash/functions.bash"

files="$profile $shell_aliases $shell_functions"

for setup_file in $files; do
        test -f "$setup_file" && . $setup_file
done
If you can do it go ahead and do it, if you can't do it then don't even criticize it. - gingerdesu

User avatar
rhowaldt
Dog
Posts: 4565
Joined: Wed Oct 17, 2012 9:01 am
Contact:

Re: Post your Command line tricks

Unread post by rhowaldt » Sun Jul 12, 2015 1:14 pm

Code: Select all

sudo iwlist wlan0 scan | grep Frequency | sort | uniq -c | sort -n
will show you a list of wifi-channels in use and how many different computers are using that channel. useful for finding the emptiest (and thus, theoretically, fastest) channel.
to see which channels your modem supports, use

Code: Select all

iwlist wlan0 channel
All statements are true in some sense, false in some sense, meaningless in some sense, true and false in some sense, true and meaningless in some sense, false and meaningless in some sense, and true and false and meaningless in some sense.

User avatar
Dr_Chroot
Alfalfa
Posts: 1100
Joined: Mon Jun 09, 2014 9:49 pm
Location: among the sagebrush
Contact:

Re: Post your Command line tricks

Unread post by Dr_Chroot » Sun Jul 12, 2015 5:23 pm

^ Sweet! Thanks rho.
Fight internet censorship.
EFF | Tor Project | Bitcoin

"There have been times throughout American history where what is right is not the same as what is legal. Sometimes to do the right thing you have to break the law." - Edward Snowden

User avatar
rhowaldt
Dog
Posts: 4565
Joined: Wed Oct 17, 2012 9:01 am
Contact:

Re: Post your Command line tricks

Unread post by rhowaldt » Tue Jul 21, 2015 1:10 am

from here: http://stackoverflow.com/questions/1323 ... ng-process

1. find process

Code: Select all

┌┤rhowaldt@lalala [~]
└──┤$ ps aux | grep nicotine
rhowaldt 19459  0.0  0.1   4552  2104 pts/2    S+   04:09   0:00 grep --color=auto nicotine
rhowaldt 29892  4.4  3.5 160016 72628 ?        Sl   Jul20  12:34 /usr/bin/python /usr/bin/nicotine
2. find connections of process:

Code: Select all

┌┤rhowaldt@lalala [~]
└──┤$ ls -l /proc/29892/fd
total 0
lr-x------ 1 rhowaldt rhowaldt 64 Jul 21 04:03 0 -> pipe:[1484919]
lrwx------ 1 rhowaldt rhowaldt 64 Jul 21 04:03 1 -> /dev/tty1
lrwx------ 1 rhowaldt rhowaldt 64 Jul 21 04:03 10 -> /home/rhowaldt/.nicotine/config.wordindex.db
lrwx------ 1 rhowaldt rhowaldt 64 Jul 21 04:03 11 -> /home/rhowaldt/.nicotine/config.buddywordindex.db
lrwx------ 1 rhowaldt rhowaldt 64 Jul 21 04:03 12 -> /home/rhowaldt/.nicotine/config.fileindex.db
lrwx------ 1 rhowaldt rhowaldt 64 Jul 21 04:03 13 -> /home/rhowaldt/.nicotine/config.buddyfileindex.db
lrwx------ 1 rhowaldt rhowaldt 64 Jul 21 04:03 14 -> /home/rhowaldt/.nicotine/config.mtimes.db
lrwx------ 1 rhowaldt rhowaldt 64 Jul 21 04:03 15 -> /home/rhowaldt/.nicotine/config.buddymtimes.db
lrwx------ 1 rhowaldt rhowaldt 64 Jul 21 04:03 16 -> socket:[1484517]
lr-x------ 1 rhowaldt rhowaldt 64 Jul 21 04:03 17 -> anon_inode:inotify
lrwx------ 1 rhowaldt rhowaldt 64 Jul 21 04:03 18 -> anon_inode:[eventfd]
lr-x------ 1 rhowaldt rhowaldt 64 Jul 21 04:03 19 -> /proc/29892/mounts
lrwx------ 1 rhowaldt rhowaldt 64 Jul 21 04:03 2 -> /dev/tty1
lr-x------ 1 rhowaldt rhowaldt 64 Jul 21 04:03 20 -> pipe:[1485295]
l-wx------ 1 rhowaldt rhowaldt 64 Jul 21 04:03 21 -> pipe:[1485295]
lrwx------ 1 rhowaldt rhowaldt 64 Jul 21 04:03 22 -> socket:[1485974]
lrwx------ 1 rhowaldt rhowaldt 64 Jul 21 04:03 23 -> socket:[9280199]
lrwx------ 1 rhowaldt rhowaldt 64 Jul 21 04:03 24 -> socket:[9280208]
lrwx------ 1 rhowaldt rhowaldt 64 Jul 21 04:10 25 -> socket:[9280706]
lrwx------ 1 rhowaldt rhowaldt 64 Jul 21 04:10 26 -> socket:[9281548]
lrwx------ 1 rhowaldt rhowaldt 64 Jul 21 04:03 27 -> socket:[9281549]
lrwx------ 1 rhowaldt rhowaldt 64 Jul 21 04:10 28 -> /home/rhowaldt/.nicotine/incompletefiles/INCOMPLETE38fad79680e0bf38dbb5cd7be4022a9bKing Oliver - One More Time 15-4-1931.MP3
lrwx------ 1 rhowaldt rhowaldt 64 Jul 21 04:10 29 -> /home/rhowaldt/.nicotine/incompletefiles/INCOMPLETE1fb6be07cfcf2da2df038bddcd02f32209 Sensation Rag.mp3
lrwx------ 1 rhowaldt rhowaldt 64 Jul 21 04:03 3 -> /home/rhowaldt/.nicotine/config.files.db
lrwx------ 1 rhowaldt rhowaldt 64 Jul 21 04:03 30 -> socket:[9283829]
lrwx------ 1 rhowaldt rhowaldt 64 Jul 21 04:10 31 -> socket:[9075282]
lrwx------ 1 rhowaldt rhowaldt 64 Jul 21 04:10 32 -> /home/rhowaldt/.nicotine/incompletefiles/INCOMPLETEa2f94f84cf9d500e95908b9710d0e7727 - Memphis Blues (Or, Mister Crump).m4a
lrwx------ 1 rhowaldt rhowaldt 64 Jul 21 04:10 33 -> /home/rhowaldt/.nicotine/incompletefiles/INCOMPLETE3cc0b04af822b47fadd65eb60437e30fwilli mae 'big mama' thornton - the big change.mp3
lrwx------ 1 rhowaldt rhowaldt 64 Jul 21 04:03 4 -> socket:[1484509]
lrwx------ 1 rhowaldt rhowaldt 64 Jul 21 04:03 5 -> anon_inode:[eventfd]
lrwx------ 1 rhowaldt rhowaldt 64 Jul 21 04:03 6 -> /home/rhowaldt/.nicotine/config.buddyfiles.db
lrwx------ 1 rhowaldt rhowaldt 64 Jul 21 04:03 7 -> /home/rhowaldt/.nicotine/config.streams.db
lr-x------ 1 rhowaldt rhowaldt 64 Jul 21 04:03 8 -> /dev/urandom
lrwx------ 1 rhowaldt rhowaldt 64 Jul 21 04:03 9 -> /home/rhowaldt/.nicotine/config.buddystreams.db
All statements are true in some sense, false in some sense, meaningless in some sense, true and false in some sense, true and meaningless in some sense, false and meaningless in some sense, and true and false and meaningless in some sense.

User avatar
wuxmedia
Grasshopper
Posts: 6445
Joined: Wed Oct 17, 2012 11:32 am
Location: Back in Blighty
Contact:

Re: Post your Command line tricks

Unread post by wuxmedia » Fri Jan 29, 2016 3:31 pm

What's my public IP? maybe I need it in a script and don't want to fuck around with a browser and whatsmyip.com?

Code: Select all

wget http://ipinfo.io/ip -qO -
or for the esoteric who happen to be behind a port 80 blocked FW:

Code: Select all

dig +short myip.opendns.com @resolver1.opendns.com
requries dig (dnstools pkg)
Thanks to Rusty.
"Seek, and Ye shall find"
"Github | Chooons | Site"

User avatar
rust collector
Motörhead
Posts: 535
Joined: Mon Jan 13, 2014 3:56 pm
Location: no_nb

Re: Post your Command line tricks

Unread post by rust collector » Fri Jan 29, 2016 3:56 pm

Nope, thanks to WüX
You knew how, I did not...

User avatar
ivanovnegro
Minister of Truth
Posts: 5448
Joined: Wed Oct 17, 2012 11:12 pm

Re: Post your Command line tricks

Unread post by ivanovnegro » Fri Jan 29, 2016 5:50 pm

Very cool Wux.

User avatar
wuxmedia
Grasshopper
Posts: 6445
Joined: Wed Oct 17, 2012 11:32 am
Location: Back in Blighty
Contact:

Re: Post your Command line tricks

Unread post by wuxmedia » Fri Jan 29, 2016 6:01 pm

TBH bacon posted something like this - maybe not in this topic.
"Seek, and Ye shall find"
"Github | Chooons | Site"

User avatar
Snap
Sperminator
Posts: 189
Joined: Sun Oct 05, 2014 8:11 pm

Re: Post your Command line tricks

Unread post by Snap » Sat Jan 30, 2016 9:50 am

Thanks, wux.

User avatar
Dr_Chroot
Alfalfa
Posts: 1100
Joined: Mon Jun 09, 2014 9:49 pm
Location: among the sagebrush
Contact:

Re: Post your Command line tricks

Unread post by Dr_Chroot » Tue Feb 02, 2016 12:00 am

Oh ho ho, this is valuable. Thanks!
Fight internet censorship.
EFF | Tor Project | Bitcoin

"There have been times throughout American history where what is right is not the same as what is legal. Sometimes to do the right thing you have to break the law." - Edward Snowden

Post Reply