oneliners/falsefriends.md

20 lines
1022 B
Markdown
Raw Normal View History

2020-08-31 13:45:34 +02:00
False friends
---
Bash and CLI-tools waiting to shoot you from behind
PATH
--
an empty string in `$PATH` is equivalent to `.`, so prepending `:` to your PATH, effectively includes the CWD into the PATH, giving it priority over everything else in the PATH, which is incredibly dangerous.
killall -1
--
2021-06-18 13:44:06 +02:00
in `killall` the parameter `-1` is - differently to `kill` - NOT interpreted as signal, but is a special variable for "applies to everything except PID1 and self". Therefore no signal is given, and the default one (15, SIGTERM) will be applied to each and every PID (but is then usually reduced again to the searchterm given). So `killall -1 java` does in pseudocode effectively: `where name is java; do [ ! PID == 1 ] && kill -s 15 $name; done` ...very dangerous
2021-06-16 16:27:27 +02:00
grep -irl
--
you'd normally expect, that `grep -irl` will find an expression to grep for at the desired location, but it does not, if symlinks are into play. Use `grep -iRl`instead.
2021-06-27 19:53:04 +02:00
watch
--
`watch` on freeBSD is NOT the same thing as `watch` on Linux!