Selecting and killing a process in htop can be difficult because the order of the processes constantly shift. Press F
to let the cursor follow the currently selected process.
To make an alias with fish shell create a new function. Avoid recursion by using the command
command:
function ls
command ls -l
end
Kill multiple processes with htop:
F4
and filter for the processesSpace
to mark itF9
and select a signal to kill all marked processesJust learned about pkill. pkill allows to send signals to processes by specifiying the process name:
pkill -9 firefox
Here I am feeling dump that I used things like this for the last couple of years:
ps ax | grep firefox | awk '{print $2}' | xargs kill -9
JSON hard to read? Try beautifying it with:
python -m json.tool multiproject.json
Note: This also seems to validate the JSON.
Just a quick one because I need this all the time but I keep forgetting it: How to append the current date to a filename.
touch abcd_`date +%F`
ls abcd*
> abcd_2015-09-17
or if you are using fish:
touch abcd_(date +%F)
select * from token\G
instead of
select * from token;
will display the the columns as rows below each record. This can avoid line breaks in the output and make it easier to read.
Get information about a SSL certificate:
openssl x509 -in test.crt -text -noout
Copy the ssh key from ~/.vagrant.d/insecure_private_key
and append it to the same file on the other machine to be able to log into the machine later.
Next:
vagrant package --base vm-name --output /path/to/mybox.box
Copy file to other machine. Then do:
vagrant init vm-name /path/to/mybox.box
vagrant up
To copy files to the home directory using scp you can use the shortcut ./
scp file.zip user1@123.123.123.123:./
List current main architecture:
> dpkg --print-architecture
amd64
List other architectures that are allowed on this system:
> dpkg --print-foreign-architectures
i386
Modify non-main architectures:
sudo dpkg --add-architecture test
sudo dpkg --remove-architecture test
Specifying the architecture when installing packages:
sudo apt-get install libsdl-image1.2:i386
Foreign architectures will be installed in separate directories. E.g.: /usr/lib/i386-linux-gnu/
.
Show all packages with a foreign architecture:
dpkg -l | grep :i386
More info: https://wiki.debian.org/Multiarch/HOWTO
Cool tip: When typing in a command in a urxvt you can press shift + mouse click anywhere on the current line to move the cursor.
Very useful when fixing a typo in a long command.