Run the last command with sudo: Ever typed a command and got “Permission denied”? Just type: sudo !! It re-runs the last command with root access.
🔥 Super useful! #BashTips#LinuxTricks
La personalización de la ventana de terminal y el prompt es algo que muchos pasan por alto.
A mi me gusta ajustarlo y cambiar algunas cosas dependiendo del entorno.
Corto hilo con #bashtips
(hilo) 🧵
If you need to use the command line, a few minimal things will make it much easier.
Use the command history! If you've typed some big command before, don't waste time typing it again.
By default ctrl-r activates the reverse search. Type a few letters from prev cmd…
#bashtips
Today I learned lot of files are symbolic links. Instead of using `ls -l`, you can use: `readlink -e` to do the job all the way through to the eventual file.
readlink -e `which zipalign`
==> /usr/lib/android-sdk/build-tools/debian/zipalign
#bashtips
#curl is maybe one the most used binary to request a website or make quickly some tests.
Here is some useful uses cases.
⬇️Do you have any fav one which isn't list below ⬇️?
#bashtips#pentest#bugbounty
alternatively make two lists of usernames and passwords do:
for user in $(<usernames.txt); do for pass in $(<passwords.txt); do echo "Trying ${user} with ${pass}"; done; done
#bashtips
I should clarify, obviously 'which' is going to be no different than just typing the command that is in your PATH, but it's the "sudo $( <something>)" pattern is what is dangerous here and should be avoided.
I would not recommend using sudo along with a command that you're unsure of the output (which). Even if you think you're sure, imagine what happens if someone happens to put a command into your PATH that takes precedence over the one you think it will before you run it.
TIP: Execute a script or command which is in your PATH but not in root's one as root.
sudo $(which my_awesome_script) [args…]
Use "sudo -u <user>" for any other user.
Cc: @climagic@bashtips
#bashtips NUNCA uses PATH como variable a menos que quieras modificar la viriable que YA existe y es SUPER importante para que todo ande bien. Le pasó a un amigo.
#bashtips o como evitar un dolor de cabeza:
Bash trabaja en octal y esto hace que una secuencia de 1 a 10 sea igual a: 1 2 3 4 5 6 7 10 😱😱
Entonces, si alguna variable (por ejemplo $var) va tomar los valores 8 o 9, asegurate de ponerlo así $((10#var)) para que use base 10 😬