Page 14 of 15

Re: Post your Command line tricks

Posted: Tue Feb 09, 2016 12:01 pm
by z3bra
The meme version:

Code: Select all

curl -s icanhazip.com

Re: Post your Command line tricks

Posted: Tue Feb 09, 2016 12:18 pm
by franksinistra
^ nice one

Re: Post your Command line tricks

Posted: Tue Feb 23, 2016 11:43 am
by wuxmedia
ooh nice one Zeebs. Didn't see that one.

Code: Select all

 nmap -sP 192.168.1.0/23
find out what is on your local (area) network.

Re: Post your Command line tricks

Posted: Tue Feb 23, 2016 12:59 pm
by machinebacon
arp-scan --local

probably does the same with 23.5MB less dependency bloat :D (no idea really, I just use this to show other computers in the local network)

Re: Post your Command line tricks

Posted: Tue Feb 23, 2016 1:22 pm
by wuxmedia
^ that works too.
or in fact - for no bloat at all (assuming net-tools is installed):

Code: Select all

arp -a 
:)
not so 'live' though

Re: Post your Command line tricks

Posted: Tue Feb 23, 2016 3:11 pm
by machinebacon
^ yeah, though net-tools is also an external package, at least not a base package in BBQ releases, so -- as bloated as arp-scan ;)

Re: Post your Command line tricks

Posted: Tue Feb 23, 2016 3:42 pm
by doubledutch
I use netdiscover a lot. It's a kind of crutch. Need to use tools with more expressive syntactical features like these. Thanks.

Re: Post your Command line tricks

Posted: Thu Mar 17, 2016 11:05 pm
by ivanovnegro
This looks fancy:

Code: Select all

 sudo apt edit-sources

Select an editor.  To change later, run 'select-editor'.
  1. /bin/ed
  2. /bin/nano        <---- easiest
  3. /usr/bin/vim.basic
  4. /usr/bin/vim.tiny

Choose 1-4 [2]: 
This exists since apt 1.0.

Re: Post your Command line tricks

Posted: Fri Mar 18, 2016 9:22 am
by GekkoP
^ That's really cool and of course I knew nothing about it.

Re: Post your Command line tricks

Posted: Mon Mar 21, 2016 12:44 am
by ivanovnegro
Watch your sensors in real time:

Code: Select all

watch sensors
or

Code: Select all

watch -d sensors
Of course you need lm-sensors installed and probably configured.

Re: Post your Command line tricks

Posted: Tue Apr 05, 2016 7:42 am
by wuxmedia
^ 'watch' is cool as hell, in lieu of using 'pv' to see if something's copying progress, I often run a watch on a du -sh /path/to/copy/

I wanted to do this typo as an April Fool's:

Code: Select all

mkdior 
freshens up the directory.

Re: Post your Command line tricks

Posted: Tue Apr 05, 2016 11:13 am
by linuxbbq
^ I know at least two people who tried it...

Re: Post your Command line tricks

Posted: Fri May 20, 2016 2:01 pm
by wuxmedia

Code: Select all

 while true; do while [[ $(ps aux | grep -c [s]tupid.php) -gt 9 ]]; do ps -eo user,pid,cmd,etime | grep [u]ser | grep "php /home/user/stupid.php" | tail -n1 | kill $(cut -d " " -f5) ;sleep 10s ; echo "killed one"; done ;done 
not too proud - but it did the job (of keeping only 9 silly php scripts running, by killing the newest one) and saved the day
note the gorgeous 'while true' loop wrapping the 'while' loop..

Re: Post your Command line tricks

Posted: Fri May 20, 2016 2:56 pm
by dkeg
*did the job

Re: Post your Command line tricks

Posted: Fri May 20, 2016 3:09 pm
by ivanovnegro
Playing with systemd a bit and still trying to learn some important commands to enable/disable services.

To see what is already running:

Code: Select all

systemctl list-unit-files --type=service | grep enabled
Now, let's trim down some shit as root:

Code: Select all

systemctl stop *unneeded.service*

Code: Select all

systemctl disable *unneeded.service* 
Used it to disable mpd from running at boot as a service after a fresh install. Finally I know how to use systemd properly and with my preferred music application mpd. Because I was still using sysvinit commands.

Code: Select all

systemctl status *unneeded.service*
tells you if it worked.

You probably know all that but as we say, it did the job for me.

Re: Post your Command line tricks

Posted: Fri Mar 10, 2017 2:33 pm
by wuxmedia
i still use sysv init commands :P
muscle memory...

So this is funny, when it's sunny, turn my dark screen into a bright white sunshine proof screen!

Code: Select all

xcalib -invert -alter
or even

Code: Select all

xcalib -i -a
then use a broweser plugin to invert the screen colours and there we are. :)
I bound it to the think launcher. as it wasn't doing anything else.

Re: Post your Command line tricks

Posted: Sun Mar 12, 2017 8:16 am
by machinebacon
^ there might even be a way of automatically changing it, if the box has the ambient light sensor. Well, laziness :D

Re: Post your Command line tricks

Posted: Mon Mar 13, 2017 9:07 am
by wuxmedia
^ there is/was a project which has that idea.
otherwise it's xbacklight bound to the original keys for lighting

Re: Post your Command line tricks

Posted: Mon Mar 13, 2017 4:57 pm
by machinebacon
^ overkill it: get the weather stats from an API every 10 minutes, and as soon as it's "Sunny" make the screen inverted :D
a bit like redshift huh

Re: Post your Command line tricks

Posted: Wed Jun 14, 2017 10:45 pm
by z3bra
You guys should certainly check this: http://www.tedunangst.com/flak/post/sct ... emperature
A simple way to update you screen color to the time of day.

Now to get back to the topic of cool CLI tricks:

Code: Select all

echo 'main(){printf("hello, world!\n"); return 0}' > hello.c
cc -static hello.c -o hello
mkdir /ns/handcraft && cp hello /ns/handcraft/
ip netns add handcraft
ip netns exec handcraft unshare -fpium --mount-proc env -i container=handcraft PATH=. chroot /ns/handcraft hello
And you've just made the smallest linux container in the world!

Another really neat trick to try out C code:

Code: Select all

$ echo '#include "/dev/stdin"' > pgm.c
$ cc pgm.c
int main() {
    printf("Compile time code!\n");
    return 0;
}
^D
$ ./a.out
Compile time code!
Useless, but cool as shit right?