Thomas Sampson


1 Comment

Fixing Ubuntu/Xubuntu 14.04 screen resolution in VirtualBox

After recently installing Ubuntu 14.04 inside VirtualBox and installing the guest editions, I was stuck with a very small screen resolution. Apparently this is a bug with VirtualBox and until a fix is applied to the VirtualBox guest additions package, the following command should be used to fix this issue:

sudo apt-get install virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11

Source: http://askubuntu.com/questions/451805/screen-resolution-problem-with-ubuntu-14-04-and-virtualbox

Advertisements


Leave a comment

Checking Unix Executable Dependencies

Tonight I needed to check the runtime dependencies of a native unix executable. Luckily this can be achieved with a single command using the ldd utility (linux) or otool (MacOSX) to print a list of shared object dependencies as follows;

Linux

ldd myapp

MacOSX

otool -L myapp

Example Output

linux-gate.so.1 => (0xb76f8000)
libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xb7601000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb75d5000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb75b6000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb759b000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb73f6000)
/lib/ld-linux.so.2 (0xb76f9000)


Leave a comment

Command Line Aliases/Macros

Preface

Entering long winded commands with many parameters, paths and redirection in the shell/terminal can be time consuming, repetitive and prone to human error. Luckily on both Windows and on Linux you can provide simple abbreviations for long commands.

Windows

On Windows the DOSKEY command (provided by default with the operating system) is pretty versatile and can be used to easily configure macros and command abbreviations. DOSKEY is actually resident during all Windows command line sessions and is the underlying system responsible for maintaining the command history (which can be navigate with the updown/pgup/pgdown keys). Below I have listed some example usages of DOSKEY;

# Note: The $G character is a special doskey escape character for the
#       redirect character '>' which allows it to be specified as part of
#       the command without redirecting the doskey command itself.

doskey /history                                       # Show history of all previously run commands
doskey /reinstall                                     # Clear command history
doskey here=explorer .                                # Add 'here' macro to open an explorer window at the current location
doskey desktop=cd "%USERPROFILE%\Desktop"             # Add 'desktop' macro which takes you to the current user's desktop
doskey mp3list=dir %CD%\*.mp3 /S /O:N $G mp3list.txt  # Add 'mp3list' macro to recursively and alphabetically list all .mp3
                                                      # files below the current directory, inside mp3list.txt

Note: Any macros configured using doskey are only active for the active command line session. To create macros which persist between sessions consider placing all macro creation commands in a batch script, you then have two options:

  1. Create a shortcut which opens the command line and runs your batch script immediately (shortcut location = %comspec% /k %path_to_script%)
  2. Use an alternative command line environment such as Console2 which can be configured to automatically run your batch script on start-up.

Linux/OSX

On Unix-esque systems it’s pretty much the same kind of setup using the alias command. Some example usages are listed below;

# Note: All alias entries are wrapped in single quotes so there is no requirement for special alias
#       escape characters for piping / redirecting streams

alias here='nautilus ${PWD}'                          # Add 'here' macro to open a nautilus window at the current location
type here                                             # Prints the expanded version of the 'here' macro
unalias here                                          # Unregister the 'here' alias
alias blog='firefox https://tomtech999.wordpress.com'  # Add a 'blog' alias to open your blog in firefox
alias dumpenv='export -p | grep "/" > env.txt'        # Dump all bash environment variables containing a path to 'paths.txt'

Note: As with DOSKEY on Windows, any macros configured using ‘alias’ are only active for the active bash shell session. The easiest way to make aliases persist between bash sessions is to add all of your alias commands to the bashrc shell configuration file located in your home directory (~/.bashrc ). This script is executed whenever you open a bash shell and can be used to automatically register aliases for all bash sessions.

References

Microsoft DOSKEY Documentation
10 Handy Bash Aliases
Hak5 Linux Temrinal 101 – Create Your Own Commands
30 Handy Bash Shell Aliases For Linux/Unix/MacOSX


Leave a comment

Ubuntu Transparent Panels

To achieve 100% transparent panels within Ubuntu, this involves modifying the default theme (Ambience).

sudo cp -R /usr/share/themes/Ambiance ~/.themes/
sudo gedit ~/.themes/Ambiance/gtk-2.0/apps/gnome-panel.rc

Then comment out the following line, as below

#bg_pixmap[NORMAL] = "img/panel.png"

A theme switch (from System > Preferences > Appearance) is required for changes to be applied. Now setting the transparency on panels effects all areas 🙂


Leave a comment

Linux Backup

A really thorough guide to backing up your Linux system including;

  • Backing up the entire root directory
  • Restoring from backups
  • Backup/Restore to/from remote machine
  • Retaining file permissions
  • Backup/Restore GRUB configurations

https://help.ubuntu.com/community/BackupYourSystem

A number of backup/restore utilities are mentioned on the above page, my favourite being the simple TAR tool. Details on backing up using TAR can be found here…

https://help.ubuntu.com/community/BackupYourSystem/TAR


Leave a comment

SSH Port Redirection

This is a really useful technique I recently discovered which allows you to bind a port on your local machine to the local port on a remote machine. Why would you want to do this?

Well in my case I was working on a remote web server via ssh, setting up some web aplications on various different ports. The hosting company had yet to open these ports to the outside world. However, this technique allowed me to bind the local ports on the remote machine (running the web applications) to my local machine. This allowed me to test and configure each application as if it was installed on my local machine, simply by accessing localhost:xx in my browser. The port numbers don’t even have to match! I ended up binding remote port 8080 to port 80 on my local machine.

This can be achieved by issuing the following command on the local machine…

ssh $REMOTE_IP -L $REMOTE_PORT:localhost:$LOCAL_PORT

Example binding remote 8080 to local 80:

ssh myhost.com -L 8080:localhost:80


Leave a comment

Changes in Ubuntu 10.04 LTS

Update: For Ubuntu 12.10 use Ubuntu Tweak

After updating to Ubuntu 10.04 LTS everything seemed to have gone smoothly but for some reason the window buttons have shifted to the left for this release! The following tutorial shows how to put them back to the right and only takes around 30 seconds to apply.

http://www.howtogeek.com/howto/13535/move-window-buttons-back-to-the-right-in-ubuntu-10.04/