News for hackers. Stuff that matters.
Re:I usually run 'w' first when troubleshooting unknown mach... by comboy on Tuesday March 27, 2018 @06:08AM (#16686872)
Can anybody explain to me why this command can return instantly but "lsof -i" sometimes takes ages to complete?
Re:I usually run 'w' first when troubleshooting unknown mach... by jakeogh on Tuesday March 27, 2018 @06:12AM (#16686896)
you need -n, otherwise it's trying to RDNS the IP's. It's a dumb default... chatting on the network without you asking while at the same time censoring the data the kernal was using... similarly "ls" might take forever (which matters if it's a big folder and you are piping it's output or just want |head) because it wants to sort (use -f to fix). The ls is a sensible default, often it's for human consumption, and the sort is way faster than a bunch of DNS lookups that could take an arb long time.

lsof has a good case to join coreutils.

Re:I usually run 'w' first when troubleshooting unknown mach... by ktpsns on Tuesday March 27, 2018 @09:21AM (#16688010)
A similar issue as with the "-n" flag for netcat exists for "ls": Frequently "ls" is aliased by default in users home directories:

   $ type ls
   ls is aliased to `ls --color=auto'
On slow file systems (for instance, think of shared machines with large directories, NFS and heavy load) this can take ages to give output. Instead, if you just call /bin/ls, this call only calls http://man7.org/linux/man-pages/man3/readdir.3.html and thus gives output promptly.
Re:I usually run 'w' first when troubleshooting unknown mach... by kbenson on Tuesday March 27, 2018 @10:35AM (#16688786)
I've seen \ls used to get the unaliased system version of ls. Likely useful for those commands where you don't want the aliased version and aren't sure if they live in /bin or /usr/bin.
Re:I usually run 'w' first when troubleshooting unknown mach... by ssebastianj on Tuesday March 27, 2018 @04:10PM (#16692278)
Nice, didn't know about "\ls"! I wonder what's the difference between "\ls" and "command ls". Yes, it's a bit longer to type but the output is the same, I'm asking about what happens behind the scenes.
Re:I usually run 'w' first when troubleshooting unknown mach... by comboy on Tuesday March 27, 2018 @06:58AM (#16687094)
thanks!