https://thoughtstreams.io/jonaspf/linux-stuff/Linux stuffjonaspf2016-02-05T10:37:41Zhttps://thoughtstreams.io/jonaspf/linux-stuff/#card-9937Cool tip: When typing in a command in...2016-02-05T10:37:41Z2016-02-05T10:37:41Z
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.
https://thoughtstreams.io/jonaspf/linux-stuff/#card-9681Multiple architectures on Ubuntu
===...2015-12-03T14:08:24Z2015-12-03T14:08:24Z
Multiple architectures on Ubuntu
===========================
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
https://thoughtstreams.io/jonaspf/linux-stuff/#card-9569To copy files to the home directory u...2015-11-05T11:59:21Z2015-11-05T11:59:21Z
To copy files to the home directory using scp you can use the shortcut `./`
```
scp file.zip user1@123.123.123.123:./
```
https://thoughtstreams.io/jonaspf/linux-stuff/#card-9549How to copy a vagrant image to anothe...2015-10-28T16:45:07Z2015-10-28T16:45:07Z
How to copy a vagrant image to another machine
========================================
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
```
Source: http://stackoverflow.com/questions/19094024/is-there-any-way-to-clone-a-vagrant-box-that-is-already-installed
https://thoughtstreams.io/jonaspf/linux-stuff/#card-9483SSL
===
Get information about a S...2015-10-21T09:10:29Z2015-10-21T09:10:29Z
SSL
===
Get information about a SSL certificate:
```
openssl x509 -in test.crt -text -noout
```
https://thoughtstreams.io/jonaspf/linux-stuff/#card-9437Mysql
=====
```
select * from t...2015-10-15T15:21:27Z2015-10-15T15:21:27Z
Mysql
=====
```
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.
https://thoughtstreams.io/jonaspf/linux-stuff/#card-9311Just a quick one because I need this ...2015-09-17T20:41:02Z2015-09-17T20:41:02Z
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)
```
https://thoughtstreams.io/jonaspf/linux-stuff/#card-9308JSON hard to read? Try beautifying it...2015-09-17T16:49:47Z2015-09-17T16:49:47Z
JSON hard to read? Try beautifying it with:
```
python -m json.tool multiproject.json
```
Note: This also seems to validate the JSON.
https://thoughtstreams.io/jonaspf/linux-stuff/#card-9305Just learned about pkill. pkill allow...2015-09-16T15:40:20Z2015-09-16T15:40:20Z
Just 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
```
https://thoughtstreams.io/jonaspf/linux-stuff/#card-9278Kill multiple processes with htop:
...2015-09-11T11:02:29Z2015-09-11T11:02:29Z
Kill multiple processes with htop:
* Press `F4` and filter for the processes
* For each process press `Space` to mark it
* Press `F9` and select a signal to kill all marked processes
https://thoughtstreams.io/jonaspf/linux-stuff/#card-9277To make an alias with fish shell crea...2015-09-11T11:00:43Z2015-09-11T11:00:43Z
To make an alias with fish shell create a new function. Avoid recursion by using the `command` command:
function ls
command ls -l
end
https://thoughtstreams.io/jonaspf/linux-stuff/#card-9276Selecting and killing a process in ht...2015-09-11T11:00:29Z2015-09-11T11:00:29Z
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.