Get the initial username which you used to login to your Linux system
If you need the initial user which you used to login to your Linux system or the time when you login you can do:
whoami
One purpose of this could be the .bashrc to show different Bash Prompts for root to different users:
if [ $(whoami) = "root" ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[41;33m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
Some useful Unicode chars
Copy and paste at will, they're free!
- German quotation marks: „ “ (Ubuntu-Hotkey: AltGr+v and AltGr+b)
- English quotation marks: “ ”
- En dash: –
- Em dash: —
- Ellipsis: …
Some useful hints for users of Ubuntu Linux
- Your Ubuntu comes with a searchable list of Unicode chars. Go to Accessories / Character map.
Ctrl + F
searches for a character by name. - If you want to write all of them (and more) yourself, [configure a compose key](https://makandracards.com/makandra/1030-insert-an...
GNOME3 Notifications For Skype ~ Web Upd8: Ubuntu / Linux blog
- Also works on Gnome 2
- Much prettier than Skype notifications
- Better visibility
LibreOffice won't embed most fonts into PDFs (with fix)
- LibreOffice Impress, Writer, etc. doesn't embed most fonts into the PDFs it generates.
- This means if you share a slide show with a font that is not Arial or Times, other people will get an error message "Cannot extract the embedded font 'XYZ Some characters may not display or print correctly" and unreadable text. Everybody loses.
- Some forums will recommend that you tick "PDF/A-1a" in the PDF options to make LibreOffice embed fonts. In reality, thi...
Skype 4.0 for Linux
Promises unified window for all chat conversations, better call quality.
Upgrade seems to work fine. If you installed your old skype from a Ubuntu repository, you need to remove it first using:
sudo apt-get remove skype
Then simply install the .deb
from the official page. You won't lose any settings.
Linux: How to add a task bar to VNC displays
If you are using VNC to run Selenium tests, it may be hard to see what's going on since by default there is no list of open windows and Alt
+Tab
won't work.
Solving that is easy:
-
Install a panel of your choice (like lxpanel) which offers task switching:
sudo apt-get install lxpanel
(You can't use
gnome-panel
because it won't start twice -- but lxpanel does a good job) -
To have that panel appear on VNC screens by default, edit
~/.vnc/xstartup
...
How to find out Your Ubuntu / Debian Linux is 32 bit or 64 bit
uname -m
i686
means 32-bit.
Linux: Mount second encrypted HDD automatically without entering a password
This is one possibility to do this. There are other and maybe even better ways to do this.
-
Generate a key for your encrypted harddisk:
dd if=/dev/random of=/home/bob/keyfile_sdb1 bs=4096 count=1
-
Then add your keyfile to encrypted harddisk: How to change your dm-crypt passphrase (step 3)
-
Create a mountpoint:
mkdir /mnt/space
-
Create a script e.g. in your homedirectory (/home/bob/mount_sdb1.sh):
#!bin/bash ...
TeamViewer 7 finally works with multiple screens under Linux
TeamViewer 6 and lower had an issue where they would see a multi-monitor Linux setup as a single wall of pixels. This is fixed in version 7. The guest can now select the currently active screen from the TeamViewer menu.
Ubuntu: Reload Gnome panel while keeping user session
Sometimes you need to restart the Gnome panel, e.g. when you installed a new Gnome panel widget but the widget list was cached before.
You often don't want to do sign out and back in for this.
Instead, just run:
killall gnome-panel
This will terminate all gnome-panel
processes. On my machine (Ubuntu 11.04) the panel then restarted itself after a moment.
If the panel does not automatically come back, press Alt+F2
to bring up the Gnome "run" box and start gnome-panel
from there.
Skype For Linux With Tabs Support Using SkypeTab NG
SkypeTab-NG (NG stands for Next Generation) is a tool that adds tabs to Skype for Linux. Besides providing a tabbed chat window, the SkypeTab-NG also embeds both the conversation and the main Skype windows in a single window.
How to fix: "500 Internal Server Error" after adding Rack::Bug
When Rack::Bug
has been added to your project and your Apache2/Passenger only replies with an Error 500 (Internal Server Error
) you won't get any love from both application and Apache logs.
You can start a script/server
and try connecting there. It should also fail but you will most likely see this error:
Internal Server Error
undefined method `new' for "Rack::Bug":String
While the following is (for some reason) working on OSX...
config.middleware.use "Rack::Bug", :secret_key => '...'
...you need to do this so it wor...
Improve web font rendering in Windows by autohinting fonts
Web fonts are awesome. After being restricted to Arial for two decades there is finally a cross-browser way to embed fonts into web pages.
Unfortunately while web fonts look awesome on Linux and MacOS, they look horrible on Windows, a problem that gets worse with smaller font sizes.
The culprit is something called font hinting:
...
Make Type 1 fonts (.pfb/.pfm) appear in OpenOffice on Ubuntu Linux
When you install Type 1 fonts (like makandra's corporate typeface), they won't show up in OpenOffice. OpenOffice requires some additional files to process them. Stefan Gründel found out what to do.
There is a tool that can produce the missing files:
sudo apt-get install t1lib-bin
Now you can create .afm
files:
cd ~/.fonts
type1afm *.pfb
Restart OpenOffice and the fonts should show up.
Solve screen error "Cannot open your terminal '/dev/pts/0' - please check"
When using the screen
tool you may be unable to start a screen session but instead encounter an error:
Cannot open your terminal '/dev/pts/0' - please check.
This is because another user (you) initiated the current terminal -- you probably did a sudo su
into the user you are now trying to run screen as, right?
There are two ways to resolve this:
- Sign out and properly connect / sign in as the user you wish to use.
- Run
script /dev/null
to own the shell (more info over at [Server Fault](http://serverfault.com/questions/116775/...
Removing ANSI color codes from Rails logs
The colors in Rails log files are helpful when watching them but, since they are ANSI color codes like ^[[4;36;1m
, can be annoying when you are reading the logs with a tool that does just prints those control characters (like less
or vim
).
Remove them with sed
:
cat staging.log | sed -r "s/\x1B\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m|K]//g"
This will print the log without colors to your terminal. You can pipe the result into less
for example.
To have a file you can vim
around with, just write that output into a new file:
ca...
Truncate files to zero length
This will reduce the filesize of foo
and bar
to 0 bytes:
truncate -s0 foo bar
If the files do not exist they will be created.
You can use this to easily truncate your application's log files:
truncate -s0 log/*.log
Line wrap text from a Ubuntu Linux terminal
You can use fold
:
fold -sw 60
You can now paste your texts. fold
will echo them back, word-wrapped after 60 columns. Exit with Ctrl+C
or Ctrl+D
.
You can also use files for input and output:
fold -sw 60 input.txt > output.txt
Dragging a file into your terminal pastes the file path
When you drag a file from a Nautilus window into a terminal window, the file's path will be pasted into the terminal. This also works with multiple files.
How to install a frozen version of Firefox for your Selenium tests
Whenever Firefox updates, all your Cucumber features that use Selenium break. This is annoying.
In order to remedy this, version 0.5.0 of our geordi gem comes with a script that helps you create an unchanging version of Firefox for your Selenium tests. In particular, this new copy of Firefox will have the following properties:
- It won't update itself with a newer version
- It can co-exist with your regular Firefox installation (which you can update at will)
- It will use a profile separate from the one...
xdissent/ievms - GitHub
Microsoft provides virtual machine disk images to facilitate website testing in multiple versions of IE, regardless of the host operating system. Unfortunately, setting these virtual machines up without Microsoft's VirtualPC can be extremely difficult. These scripts aim to facilitate that process using VirtualBox on Linux or OS X. With a single command, you can have IE6, IE7, IE8 and IE9 running in separate virtual machines.
Web Upd8: Ubuntu / Linux blog
Great blog with daily news and HOWTOs for Ubuntu, Linux and Gnome.
Convert the colorspace of a PDF from RGB to CMYK under Ubuntu Linux
Note that converting from RGB to CMYK will usually degrade your colors because no exact mapping is possible. Anyway, this Stackoverflow post worked for me:
gs -dSAFER -dBATCH -dNOPAUSE -dNOCACHE -sDEVICE=pdfwrite \
-sColorConversionStrategy=CMYK -dProcessColorModel=/DeviceCMYK \
-sOutputFile=output.pdf input.pdf