Skip to main content

Posts

Showing posts with the label ubuntu

Error mounting NTFS drive from Ubuntu

I came across a new problem, at least for me, in ubuntu 14.04, while trying to mount the NTFS drives. It was just saying that I did not turned off windows system properly and therefore the filesystem is corrupt. I could mount the file system in the readonly mode. sudo mount -t "ntfs" -ro "uhelper=udisks2,nodev,nosuid,uid=1000,gid=1000,dmask=0077,fmask=0177" "/dev/sda3" "/media/bidur/d" For that, I have to create a new directory beforehand i.e. "/media/bidur/d". Just now, I came across a way to deal with the problem by using ntfsfix commad: sudo ntfsfix /dev/sda3

ubuntu (10.04) apache web server not running due to port conflict

Sometimes the port assigned to apache2 may be used by some other services. In such cases, if we try to live apache2 server then it fails.  The following message is shown in ubuntu 10.04 in my case: Starting web server apache2                                                   apache2: Could not reliably determine the server's fully qualified domain name, using 0.0.0.3 for ServerName (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down Unable to open logs Here is one of the ways to overcome this problem: 1. see who is using the port 80 : sudo lsof -i :80 2. get the pid of the services in 1. E.g.: 1577 3. kill all the services in 2. : sudo kill 1577 4. restart apache2: sudo /etc/init.d/apache2 restart

python code for querying own IP address

The  socket.gethostname() function is supposed to give the IP address of the machine but it may not give the real IP address but gives 127.0.0.1 . Even it is said that removing 127.0.0.1 from the /etc/hosts file (in ubuntu) can give the real IP but it could not help in my case. import socket nodeName = socket.gethostname() info = socket.getaddrinfo(nodeName, None, 0, socket.SOCK_STREAM) print [x[4][0] for x in info]   # prints 127.0.0.1 I came through another way which can print the real IP as well: import commands NodeIPS = commands.getoutput("/sbin/ifconfig | grep -i \"inet\" | grep -iv \"inet6\" | " +                          "awk {'print $2'} | sed -ne 's/addr\:/ /p'") print NodeIPS  # prints 127.0.0.1 and realIP(eg. 202.145.12.22) Note: code worked for ubuntu 12.04 and python 2.7 Sometimes its handy to have the IP address as list items. The following code does the work. impo...

Installing NS-3 in Ubuntu

Installing testing it and running NS-3 in Ubuntu 10.04 NS-3 is a discrete-event network simulator basically for simulating Internet systems. #The list of Dependency for ns 3.12(sorry if something is missing): sudo apt-get install gcc g++ python sudo apt-get install gcc g++ python python-dev sudo apt-get install mercurial sudo apt-get install bzr sudo apt-get install gdb valgrind sudo apt-get install gsl-bin libgsl0-dev libgsl0ldbl sudo apt-get install flex bison sudo apt-get install g++-3.4 gcc-3.4 sudo apt-get install tcpdump sudo apt-get install sqlite sqlite3 libsqlite3-dev sudo apt-get install libxml2 libxml2-dev sudo apt-get install libgtk2.0-0 libgtk2.0-dev sudo apt-get install libgtk2.0-0 libgtk2.0-dev sudo apt-get install vtun lxc sudo apt-get install uncrustify sudo apt-get install doxygen graphviz imagemagick sudo apt-get install texlive texlive-pdf texlive-latex-extra texlive-generic-extra texlive-generic-recommended sudo apt-get install python-sphinx dia t...

VirtualBox in ubuntu10.04

VirtualBox is a virtualization tool which allows us to install and run different OS like windows and linux. I had tried installing ubuntu10.04 over ubuntu 10.04. To install it in Ubuntu (10.04 for now): i. go to Ubuntu Software Center and search for Oracle VM VirtualBox, then click install. ii. Goto virtualbox.org -> Downloads and get the package that you need for your system (For e.g. ".deb" package for Ubuntu) iii. Install virtualbox from commandline: sudo apt-get update sudo apt-get install virtualbox-4.1 If writing the version number fails then trying without version number might work: sudo apt-get install virtualbox After installing the Virtualbox, we can install any Operating System over it. Installing a new OS is more or less similar to installing an OS in a new computer but you need to do some more before proceeding to install the new OS: i. Open the VirtualBox window, then Press New button and create a new Virtual Machine. ii. Specify the Name (e.g...

JDK6 in Ubuntu 10.04

To install JDk 6 (Java Developement Kit 6 ) in ubuntu 10.04 from the command line, we just need to use the following command. This will install all other dependencies automatically.  sudo apt-get install openjdk-6-jdk

shutdown

We may think that why to bother typing commands when using the GUI to shutting down the computer is easy and straight. But at time we may want to shut down the computer after some time when the download finishes or some other task completes. But we cannot wait until that time. So we can use shutdown command in such cases. For example, if you want to shut down the computer at 2:12 pm then you can use the following command in your ubuntu box: sudo shutdown -h 14:12 "Going to Shutdown at 2:12 pm"

Kile

Though the default installation of Kile, a latex editor, in ubuntu works fine for simple things, but at times it needs extra packages (for e.g. algorithm.sty, etc). In that case we can install the following extra scientific packages in Ubuntu linux as follows: sudo apt-get install texlive-science

Hide drive icon from your Ubuntu Desktop

It is useful when we wish to configure our desktop item to be stable. Sometimes its annoying when the drive icons appear and disappear when we mount and unmount them. So follow the following steps to get rid of this situation:    1. Hit Alt+F2 then the  "Run Application" window will apper.    2. Then type "gconf-editor" and press Enter  so as to get the Configuration Editor.    3. Browse to apps > nautilus > desktop.    4. Check off  "volumes_visible"  then you are done

Bash script to archive different files and folders into a single folder which will be named using current timestamp

I use this script to back up files that are created in different locations. I feel easy to collect all the related files and folders to compress and save them as a single zip archive which is named as per the current date and time. #!/bin/bash # this program creates a zip archive of myFolder(containing files and folders), file1 , file2 , file3 and file4 and puts the archive in myOpDir. The name of the final zip archive will be given by the current timestamp. For eg : final_20111220_103015.zip #create a directory for putting all the files myFolder="/home/user/Desktop/myFolderWithContents" myOpDir="/home/user/Desktop/myFinalDir" file1="/home/user/Desktop/test.tcl" file2="/home/user/Desktop/test.dump.xml" file3="/home/user/Desktop/myDir/test.txt" file4="/home/user/Desktop/myDir/test.txt.xml" mkdir $myOpDir/temp # copy the files and folder to to temp dir cp -r $myFolder $myOpDir/temp/` cp $file1 $myOpDir/temp/test.tcl cp $fil...

ffmpeg video converter

Some tips to remember while using ffmpeg in ubuntu: #install restricted packages (more info in: http://ubuntuforums.org/showthread.php?t=786095 ) sudo apt-get install ubuntu-restricted-extras # video converting with ffmpeg The default ffmpeg installation does not support all features so do this way: sudo apt-get install ffmpeg libavcodec-extra-52 #Change flv/avi files to mp4(parameters customized for nokia 5800 mobile phone) ffmpeg -f mp4 -vcodec libxvid -s 640x360 -b 768k -r 25 -aspect 16:9 -acodec libfaac -ab 96k -ar 44100 -ac 2 output.mp4 -i input.avi/flv #change to mp3 (more info in http://ubuntuforums.org/showthread.php?t=1125181 ) ffmpeg -acodec libmp3lame -ac 2 -ab 128 -vn -y output.mp3 -i “mysource.flv” # bash scrit to convert all files in a folder to mp4 using the above method for i in *; do ffmpeg -f mp4 -vcodec mpeg4 -b 2200k -r 30 -s 640x360 -acodec libfaac -ar 32000 -ab 128k -ac 2 "_$i.mp4" -i "$i"; done # convert all files in the current folder to...