If you are on a Linux shell and want to open a file with whatever default application is configured for that type, this often works:
xdg-open Quote.odt
xdg-open invoice.pdf
xdg-open index.html
Make an alias so you have a simpler API (like Mac OS): alias open=xdg-open
or alias x=xdg-open
.
You can choose your "Default applications" via UI in the Ubuntu "Settings" application (gnome-control-center
). This is just a very rough setting (e.g. open Photos with Shotwell Viewer).
If a certain file...
The following sums up all connections (ESTABLISHED, TIME_WAIT, FIN_WAIT, etc.) and sorts it:
netstat -n | awk ' $5 ~ /^[0-9]/ {print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
Works on FreeBSD and Linux.
You login to a Linux server with a performance issue: what do you check in the first minute?
uptime
dmesg | tail
vmstat 1
mpstat -P ALL 1
pidstat 1
iostat -xz 1
free -m
sar -n DEV 1
sar -n TCP,ETCP 1
top
When you make a simple TCP connection to a remote server (like telnet
), your client won't normally notice when the connection is unexpectly severed on the remote side. E.g. if someone would disconnect a network cable from the server you're connected to, no client would notice. It would simply look like nothing is being sent.
You can detect remote connection loss by configuring your client socket to send TCP keepalive signals after some period of inactivity. If those signals are not acknowledged by the other side, your client will terminat...
Article shows how to make a script that fakes one kind of content when printed with cat
, but uses different code when executed:
$ printf '#!/bin/bash\necho doing something evil!\nexit\n\033[2Aecho doing something very nice!\n' > backdoor.sh
$ chmod +x backdoor.sh
$ cat backdoor.sh
#!/bin/bash
echo doing something very nice!
$ ./backdoor.sh
doing something evil!
After adding a vdisk to an ESXi linux guest you will assert that you can't find a new device in the running VM. You have to force a SCSI rescan.
grep mtpspi /sys/class/scsi_host/host?/proc_name
echo "- - -" > /sys/class/scsi_host/<host>/scan
and insert the host found in point two for <host>
cat /proc/scsi/scsi
should now show the new ad...There are some frontends available, but they all suck, are no longer maintained or are hard to install.
As a surprisingly comfortable alternative I have found a command line tool s3cmd
:
sudo apt-get install s3cmd
When you run s3cmd
the first time it will ask you for your access key ID and secret access key. This information is cached somewhere so you only need to write them once. To reconfigure later, call s3cmd --configure
.
Once you're done setting up, s3cmd
gives you shell-like commands like s3cmd ls
or `s3cmd del som...
This is useful to kill processes like ruby my-script.rb
:
pkill -f my-script.rb
With great power comes great responsibility.
If you get this error (probably because you want to load some modules):
# modprobe xt_comment
FATAL: Could not load /lib/modules/3.2.0-40-generic/modules.dep: No such file or directory
The reason could be that apt-get autoremove
already removed /lib/modules/.../modules.dep
even if you still using this kernel version:
# uname -r
3.2.0-40-generic
# ls -l /lib/modules/
total 24
drwxr-xr-x 4 root root 4096 Oct 22 17:05 3.2.0-68-generic
drwxr-xr-x 4 root root 4096 Jan 7 16:38 3.2.0-69-generic
drwxr-...
Traveling Ruby is a project which supplies self-contained, "portable" Ruby binaries: Ruby binaries that can run on any Linux distribution and any OS X machine. This allows Ruby app developers to bundle these binaries with their Ruby app, so that they can distribute a single package to end users, without needing end users to first install Ruby or gems.
Adobe no longer supports their PDF reader on Linux and the official page does not offer it for download. \
However, some files may not display properly on Ubuntu's default PDF reader Evince or PDF forms may not work as expected. Hence, you may still need to use it.
Here is how to install the Adobe Reader (acroread
) if you need to:
Download the .deb
archive from the Adobe servers (yes, it's still there):
cd /tmp && wget http://ardownload.adobe.com/pub/adobe/reader/unix/9.x/9.5.5/enu/AdbeRdr9.5.5-1_i386linux_enu.deb
I...
chromedriver
binary from the ZIP file and put it e.g. into ~/bin
.Chromedriver must be available in your path. You can add ~/bin
to your path like this:
echo "export PATH=$PATH:$HOME/bin" >> $HOME/.bash_profile
If you're also using Geordi, disable automatic updating of chromedriver in ~/.config/geordi/global.yml
:
a...
tlmgr
is the TeX Live Manager and responsible for the TeX installation on your (Linux) machine.
If you're getting the message:
(running on Debian, switching to user mode!)
cannot setup TLPDB in /home/dominik/texmf at /usr/bin/tlmgr line 5336.
... tlmgr
has not been initialized. Run this to initialize it:
tlmgr init-usertree
Then, you may set e.g. a global paper size standard: tlmgr paper a4
.
When your system is not running on English, you may sometimes want to run some applications and not use your system locale.
Use cases are scripts that parse output, or just using the (possibly) more common English labels or error messages. Here is how to do that.
I will use the date
command and print the current weekday, just for the sake of an example.
Most often, setting LC_ALL
for your command should be enough. The following was run on a system using a German locale.
$ date +%...
Skype has been updated to 4.3 on Linux. This fixes group chat issues with non-linux clients.
If you have previously installed skype via ubuntu packages, you need to remove those fist via
sudo apt-get remove skype skype-bin
Try to install the 32 bit version. In serveral cases this was the way that worked out.
Grab the installer here:
See screenshot here.
This is great news because network throttling is very painful in Linux.
The features are already in Chrome Canary, so expect them to come to your Chrome sources soon.
When you tell rbenv to install a Ruby it does not know about, you will get an error message.
$ rbenv install 2.1.2
ruby-build: definition not found: 2.1.2
You can list all available versions with `rbenv install --list'.
If the version you're looking for is not present, first try upgrading
ruby-build. If it's still missing, open a request on the ruby-build
issue tracker: https://github.com/sstephenson/ruby-build/issues
(Fun fact: Recent versions of ruby-build will give you a more helpful error message which...
Sometimes you may want to print files from the command line, especially when you have lots of them.
You can use lp
for that.
To print a single example.pdf
file on your default printer, simply say:
lp example.pdf
lp
accepts multiple filenames, so to print all PDF files in the current directory:
lp *.pdf
You can specify a printer via the -d
switch:
lp -d YOUR_PRINTER_NAME *.pdf
Your printer's name is then one you defined on your system. You can check with your CUPS configuration by visiting <http://localhost:631/...
Your development machine is usually on a very good network connection.
To test how your application behaves on a slow network (e.g. mobile), you can simulate limited bandwidth.
Icons Sizes for Windows, MacOS X, iOS, Android and Linux. It's a mess!
If you have multiple monitors and want to share a given screen with your call partner, drag the caller window to the desired monitor, then start sharing.
This is for Skype 4.2+ on Linux.