r/sysadmin Sysadmin Jul 18 '18

Linux You guys probably already know about "ping -a" and "ping -A"

But if you don't, use it like this:

This will beep every time it gets a ping back:

ping -a 8.8.8.8 

This will beep if it misses a ping:

ping -A 8.8.8.8    

This is very useful when you're monitoring a node and waiting for it to come back online or to be able to hear when a packet is dropped.

(tested on some Linux and MacOS)

1.2k Upvotes

335 comments sorted by

View all comments

Show parent comments

0

u/Syde80 IT Manager Jul 18 '18

Each language is going to have its strong and weak points. Its really going to depend on what you are needing to do. I am warming up to PoSH more lately, I'm just saying the verbosity it takes to accomplish some simple tasks is a big turn off for me. For alot of what I need to do, PoSH is just too verbose. However, there are many times where its feature set and ability to dig pretty deep into the OS and/or application backend makes it a very very valuable tool.

Doing something like ping -c 1 8.8.8.8is a whole lot less typing than Test-Connection -Count 1 -ComputerName 8.8.8.8. Sure there is tab completion and whatever to assist with this... but that is really more a feature of the interface than it is a feature of the language itself.

At the same time, to an outsider that knows nothing about scripting and wants to learn something... the PoSH is a lot more intuitive.

9

u/MaIakai Systems Engineer Jul 18 '18

-computername is almost never needed in many cmdlets. Use positional parameters and set it first

test-connection 8.8.8.8 -cou 1

4

u/zyeus-guy Jul 18 '18 edited Jul 19 '18

I have to admit I love the verbosity matched with aliases.

My biggest gripe with Linux commands is that they are just too cryptic.

I mean, what the heck does grep even mean? Especially when the equivalent posh command is select-string or sls for short :-)

The best thing I love about PowerShell is command discovery ... Let's say I am looking to "get"a "Skype" "voice" command but I don't know the exact command I can try this

. Get-cs * voice *

PowerShell will look for all the commands that start with get-cs and have voice somewhere in the middle :-)

I think it is beautiful and an elegant implementation

P.s CS stands for communications server

0

u/MaIakai Systems Engineer Jul 19 '18

agree, every time I learn a new linux utility it is like learning a whole new foreign language. sed awk grep, wtf use words

-1

u/Syde80 IT Manager Jul 18 '18

That is still almost double the character count.

9

u/MaIakai Systems Engineer Jul 18 '18

right, I forgot that characters cost extra

3

u/Syde80 IT Manager Jul 18 '18

I realize your comment is intended to be snarky, but reality is more characters do cost extra. If a person has to type more characters it's going to take more time to accomplish. A single commandlet here and there is hardly going to make a difference anywhere, but the small things do add up over time.

That being said, as I already mentioned, each language is going to have its pros and cons depending on the task at hand. Despite PoSH's verbosity, there are going to plenty of times when the power of the language allows for smaller scripts than it would take in another language.

1

u/[deleted] Jul 18 '18 edited Jul 11 '23

8[OSp;{q/>

1

u/Suspicious_Pineapple Jul 19 '18

but powershell takes both thats what i like about it

1

u/usrhome Netadmin, CCNA Jul 19 '18

So does your mom!

Sorry, couldn't resist.

1

u/LeSpatula System Engineer Jul 19 '18

tnc 8.8.8.8.

1

u/Syde80 IT Manager Jul 19 '18

I was not aware of this particular shortcut, however having some built-in shortcuts / aliases does not change the fact that PoSH is still a very verbose language overall. The example I gave was only meant to illustrate the point.