Skip to main content

Posts

Showing posts with the label ubuntu

QuickSynergy - Control multiple computers with single mouse and keyboard

Sometimes, we may have to access more than one computer simultaneously, and it is not convenient to use multiple mouse and keyboards. To access multiple (mostly 2) computers at a time, one can use a KVM switch. It is a switch which toggles the access of peripherals between two computers. This is bit costly and KVM switches are not so common in electronics shop in your lane. So, here is an software alternative for KVM. QuickSynergy : It is a graphical interface (GUI) for easily configuring Synergy2 , an application that allows the user to share his mouse and keyboard between two or more computers. Also, your clipboard will be shared between the devices. Isn't it cool!! Enjoy multi-tasking.

Ubuntu: Recursively delete multiple files with specific format

Sometimes we have to delete files of specific format (common extensions, ends with ~, etc) which were spanned over a group of directories. To do so, we follow certain methods. Lets do it by an example. In my case, I've o create the temporary files, i.e., the ones ending with ~. Method 1 : Delete them manually Method 2 : Goto each such directory and run the following command rm *~ Method 3 : rm *~ rm */*~ rm */*/*~ rm */*/*/*~ First two methods need more time and to use third method, we must know the depth of recursion. Following method will solve our problem. Method Friendly : Run the following command from the parent directory from which you are deleting the files. find . -name '*~' -type f -delete This will delete all files ending with ~, from the current directory and also all its sub-directories.

Ubuntu: Directory size from terminal

In this post we gonna see how to find size of a directory from Terminal. To summarise disk usage of each file, recursively for directories, we can use the following command du [option]... [FILE/Directory]... To get the report in human readable format, along with the overall summary, use du -hs /path/to/directory To find sizes of directories recursively unto a certain depth (e.g.: depth = 2): du -h --max-depth=2 /path/to/directory

Ubuntu: Proxy settings for Maven

Recently I faced problem using maven under a proxy network and by little research, found this solution. Temporary solution : Add the following options along with your maven command -DproxySet=true -DproxyHost=myproxy.com -DproxyPort=3128 For example, to run "mvn package": mvn -DproxySet=true -DproxyHost= my.proxy.host -DproxyPort= 3128 package Permanent solution : To add the proxy settings permanently, goto {M2_HOME}/conf/settings.xml and find the <proxies> section. Un-comment the required sections and configure accordingly. To set proxy without password protection, change it as follows: <proxies>    <proxy>       <id>optional</id>       <active>true</active>       <protocol>http</protocol>       <host> proxy.host.net </host>       <port> 80 </port>  ...

Ubuntu: Problem installing flash player

Recently, I installed ubuntu updates and my browser asked me for flash player, which was previously installed. i tried to install using the regular command sudo apt-get install flashplugin-installer But, it says flashplugin-installer is already the newest version Finally, I found the workaround. Previous installation has to removed first (which anyway is not working) Run the following commands : sudo apt-get purge flashplugin-installer sudo apt-get install flashplugin-installer Viola!! It works now.

Ubuntu: Change default location of localhost

By default, localhost (127.0.0.1) points to /var/www/ directory in Ubuntu. I prefer the location to be in my home directory. To change the default location, open the file: /etc/apache2/sites-available/000-default.conf  and change it to look as follows: (My wokspace is located at /home/chaithanya/www) <VirtualHost *:80>         ServerAdmin webmaster@localhost         DocumentRoot /home/chaithanya/www         <Directory /home/chaithanya/www/>                 Options Indexes FollowSymLinks                 AllowOverride All                 Require all granted         </Directory>    ...

Ubuntu: Install with video drivers disabled

When I tried to install Ubuntu 12.04 on my PC, it halted with 4/5 dots under Ubuntu. It's stuck at that point and no progress. Sometimes you may see some distorted image or white screen. All these problems are due to incompatible video drivers. To get pass behind this screen and boot into the system, hold down SHIFT button while booting from CD/USB and press F6. Now select "nomodeset" option to prevent video drivers from loading. Now you can install Ubuntu successfully. But you may face the problem again while booting (after installation). Then boot in "Recovery Mode" and install graphics drivers from GRUB menu or command line.

Ubuntu: rSync without git subdirectory

Previously I blogged about a good backup/sync tool  rSync . While using it, I faced some problems. It replaced my .git repository and there by affected my git repo settings. I found a way to exclude sync'ing some files/folders. For this we have to use --exclude option. To exclude git sub-directory: rsync -a --exclude='.git/'  And to include some specific files, (Eg: 'c' files) rsync -a --include='*.c/' Source

Ubuntu: Access a usb flash drive from the terminal

    1. Find what the drive is called You'll need to know what the drive is called to mount it. To do that fire off: sudo fdisk -l You're looking for a partition that should look something like:   /dev/sdb1 . Remember what it's called. 2. Create a mount point Create a new directory in   /media   so you can mount the drive onto the filesystem: sudo mkdir /media/usb 3. Mount! sudo mount /dev/sdb1 /media/usb When you're done, just fire off: sudo umount /media/usb Source: StackOverflow

Ubuntu: Make bootable Windows USB

Recently I came across Ubuntu version of WinUSB, a popular tool to make bootable Windows USB. I found it to be easy and simple. Here is the official website , where you can get this tool.

Ubuntu: Rsync

Rsync is a fast and extraordinarily versatile file copying tool. It can copy locally, to/from another host over any remote shell, or to/from a remote rsync daemon. It offers a large number of options that control every aspect of its behavior and permit very flexible specification of the set of files to be copied. It is famous for its delta-transfer algorithm, which reduces the amount of data sent over the network by sending only the differences between the source files and the existing files in the destination. Rsync is widely used for backups and mirroring and as an improved copy command for everyday use. Rsync is installed in Ubuntu by default. If you need a GUI front-end, install Grsync. It is available in Ubuntu Software Center and also Synaptic package manager. Usage: Local backup sudo rsync -azvv source/ destination/ Remote Backup sudo rsync --dry-run --delete -azvv -e ssh source remoteuser@remotehost.remotedomain:/path-to-destination/ An explanation of above op...

Protect your eyes with RedShift

If you are anything like me and spends a good amount of time on computer, your eyes may say you soon that "Hey! it's fantastic. Give me some comfort or else I'll take yours". You may soon face dry-eyes or sleeping dis-orders. Let's take some precautions to save them. Now I'm not gonna discuss something like don't stare without blinking your eyes or maintain some distance from monitor, but here is a way to optimize your monitors brightness automatically according to the time-of-the-day and temperature. Redshift adjusts the color temperature of your screen according to your surroundings. This may help your eyes hurt less if you are working in front of the screen at night. To install it in Ubuntu: sudo add-apt-repository ppa:jonls/redshift-ppa sudo apt-get update && sudo apt-get install redshift To start the application, first find the coordinates of your location (lat:long). Then redshift -l lat:long (eg: redshift -l 17.033:55.20) ...

Ubuntu: Mount remote directories on a local machine

Today I'm searching for a way to mount a remote directory on my local machine, such that it acts like a local machine. The sole reason is to run the remotely compiled code locally. I've found a nice article on it and would like to blog it here. Here we go: Install SSHFS: sudo apt-get install sshfs Add root to the fuse group:  sudo adduser root fuse  Create the local backup director mkdir backup Then mount the remote /home directory to backup : sshfs -o idmap=user <username>@<remote system's ip>:/home backup Let's check if the remote directory got mounted to /backup : mount df -h To unmount the directory fusermount -u backup Check the backup folder to see your remote directory... Source : howtoforge

Ubuntu : Bugs and workarounds

Quite often we ran into some bug on Ubuntu. Thanks to such a huge community which provides solutions to many of them. Today I found a thread which includes most of the bugs and their workarounds. Here is the link. Known Hardy bugs and workarounds

Ubuntu : Upgrade Git

Sometimes simply updating from "Ubuntu update" won't update/upgrade some of the required packages. We need to to it manually by adding necessary repositories. To upgrade git: sudo add-apt-repository ppa:voronov84/andreyv sudo apt-get update sudo apt-get upgrade sudo apt-get install git If the first command result in error "couldn't connect to host"

Ubuntu : Java alternatives

Ubuntu will include openJDK by default. If you install some other version or Sun JDK, then the first installation is set to be the default one. To check if there are any other java installations: update-java-alternatives -l Change the default to any of them: update-java-alternatives -s NAME-OF-IT

Ubuntu : Install Sun java 6

Ubuntu has dropped including Sun/Oracle Java in its repository, and added OpenJDK. But, the former is more reliable than latter, and is also must for some applications. Here is a way to add Sun java 6: sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java6-installer Possible error : "couldn't connect to host" To make this version as default: here . If you want to install java 7, instead of last command try sudo apt-get install oracle-java7-installer If you are under proxy network or seen a error like Cannot add PPA: 'ppa:webupd8team/java'. Please check that the PPA name or format is correct. and if you are sure that the PPA is working, the try sudo -E add-apt-repository ppa:webupd8team/java and proceed with remaining commands.

Ubuntu : Error "couldn't connect to host"

This error will be resulted mostly because of the user permissions. To go through it, we need the simulate the initial login mode: sudo -i Now run the commands which resulted in the above error, but without prefixing with 'sudo'. Remember to go out of this mode after running your commands. To go out: exit

Ubuntu : Adding a new repository (PPA)

To add a repository ppa: sudo add-apt-repository ppa:user/ppa-name sudo apt-get update Sometimes adding a repository may result in error related to missing key. Then copy that key and run following command sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com KEY Do this for each of the missing keys. Now re-run the above two commands. If you are under proxy network or seen a error like Cannot add PPA: 'ppa:user/ppa-name'. Please check that the PPA name or format is correct. and if you are sure that the PPA is working, the try sudo -E add-apt-repository ppa:user/ppa-name

Ubuntu: Set Network proxy system-wide including Terminal

Set the proxy in "Network Proxy" setings and click "apply system-wide", and also at the following locations. Some terminal applications need them. sudo gedit /etc/apt/apt.conf.d/95proxies Acquire::http::proxy "http://username:passwd@proxy:port/"; Acquire::ftp::proxy "ftp://username:passwd@proxy:port/"; Acquire::https::proxy "https://username:passwd@proxy:port/"; sudo gedit .bashrc export http_proxy=http://username:passwd@proxy:port export https_proxy=http://username:passwd@proxy:port export HTTP_PROXY=http://username:passwd@proxy:port export HTTPS_PROXY=http://username:passwd@proxy:port Requires both CAPITALS and small ones. Some applications accepts only CAPITALS.