Linux Tips and Tricks

A collection of tips, tricks and everything linux

keep broken files when trying to unrar a failed crc chek on a rar archive file

without comments

ok just a quick note ,, if you’re tryin to unrar an archive thats been corrupted or been split up into multiple parts, keep the broken parts using unrar.

more description

4 Rar files, part1-4, 3 fails becuase of a crc check issue, so you can recover part of the archive using the keep broken flag for unrar ‘-kb’

mnk0@tree:~/downloads$ unrar x -kb Bleach_Naruto Shippuuden 98 - 720p.rar
UNRAR 3.80 beta 2 freeware Copyright (c) 1993-2008 Alexander Roshal
Extracting from Bleach_Naruto Shippuuden 98 - 720p.rar
Extracting Bleach_Naruto Shippuuden 98 - 720p.rar 99%
Calculating control sums of all volumes.
Cannot find volume Bleach_Naruto Shippuuden 98 - 720p.rar
Bleach_Naruto Shippuuden 98 - 720p.mkv - CRC failed
Total errors: 1
mnk0@tree:~/downloads$ ls Bleach_Naruto Shippuuden 98 - 720p.mkv*
Bleach_Naruto Shippuuden 98 - 720p.mkv
mnk0@tree:~/downloads$

Written by mnk0

March 7th, 2009 at 9:55 pm

Posted in Linux, Ubuntu, shell

Tagged with , , ,

Using Cisco vpn client with Ubuntu Linux Desktop

with 6 comments

Configuration

Download and install the Cisco vpn Client. im using vpnclient-linux-x86_64-4.8.02.0030-k9 at the time of this article.
(if u need it send me an email). unpack, and install in my installation i opted out of the option for starting as a daemon so i start it manually everytime.

mnk0@tree:~$ sudo /etc/init.d/vpnclient_init start

Using my PROFILE.pcf file

Then we can copy our Cisco VPN Profile over to the profile directory.

mnk0@tree:~$ cp PROFILE.pcf /etc/opt/cisco-vpnclient/Profiles/

Now we are ready to connect to our connection. Note we dont add the .pcf extension to the profile we’re going to use

mnk0@tree:~$ /etc/opt/cisco-vpnclient connect PROFILE
Initializing the VPN connection.
Contacting the gateway at 4.23.45.21
Contacting the gateway at 4.23.45.21 (balancing)
User Authentication for PROFILE...
The server has requested the following information to complete the user authentication:
Username [mnk0]:
Passcode []:
Authenticating user.
Negotiating security policies.
Securing communication channel.
Your VPN connection is secure.
VPN tunnel information.
Client address: 10.10.10.46
Server address: 4.23.45.21
Encryption: 256-bit AES
Authentication: HMAC-SHA
IP Compression: None
NAT passthrough is active on port UDP 4500
Local LAN Access is disabled

Exiting

When we are ready to exit, just hit CTRL+C on your terminal session, and shutdown the daemon.

mnk0@tree:~$ sudo /etc/init.d/vpnclient_init stop
mnk0@tree:~$ Done

Written by mnk0

February 13th, 2009 at 8:02 pm

Posted in Linux, Ubuntu, networking, ssh

Tagged with , , ,

Using a swapfile to increase the swap space on your system

with one comment

This can be a very handy function if we want to use a file, instead of a partition, and with modern filesystems the performance is almost on par with using a dedicated partition for your swap area.

1. Using dd lets make a zero’d file for the swap

dd if=/dev/zero of=/swapfile bs=1048576 count=1000

This example would create a swapfile of 1 gig using a blocksize of a megabyte (1048576).

2. Make file as a swapfile

mkswp /swapfile

3. Activate swapfile

swapon /swapfile

4. Verify that our swapfile has been activated

swapon -s

We should see something like this in the list ..

Filename Type Size Used Priority
/swapfile file 9999992 0 -2

If you want to have this a permanent solution, then adding the entry to fstab would probally be a better idea,
open up /etc/fstab in your favourite editor and add the following line.

/swapfile swap swap defaults 0 0

Written by mnk0

January 22nd, 2009 at 11:49 pm

How to check and monitor cpu core temperatures in Ubuntu

with 2 comments

Ok, so this weekend i decided to take the plunge and get myself a nice new box! I decided to go with Intel Core 2 Duo e5200 , and an Asus P5QL-E mother board, so anyways got everything mounted up and just installed Ubuntu Ibex 8.10 .. so now i wanna see what the temperature ratings are, and this is a snap with Ubuntu.

Open up a terminal and type
sudo apt-get install lm-sensors sensord

After installation of those packages we have to setup our sensors with our cpu
sudo sensors-detect

you’ll have to actually type Yes for all the next part, which is just asking about loading modules and drivers, for your cpu

So after all that we’ll have a little bit of editing to do, sensors will come up and tell you that you need to make some changes to /etc/modules, and will give you a snippet to paste into the file

sudo gedit /etc/modules

and then paste the code into the bottom of the file, for example this is what mine said

# Chip drivers
coretemp
#

Reboot and your all set, open up a terminal and type sensors to see your core temps! if you want to be real slick type watch sensors .. so you can watch the updates in the core temps every 2s .

Written by mnk0

November 30th, 2008 at 8:05 pm

Ubuntu Ibex 8.10 with ATI Radeon HD 2400 XT

with 19 comments

So, I finally decided to crack out the new Ubuntu release, and the installer seemed to be successfull and it was time to reboot the machine which is where things went terribly wrong. My login screen was a blank screen.

So I then pushed CTRL+ALT+F1 to get to a shell, and noticed that by default the ati opensource video driver in xorg.conf wasnt happy at all.

Section "Device"
Identifier "Configured Video Device"
Driver "vesa"
EndSection
Section "Monitor"
Identifier "Configured Monitor"
EndSection
Section "Screen"
Identifier "Default Screen"
Monitor "Configured Monitor"
Device "Configured Video Device"
EndSection

So after googling a bit, i discoverd that support for this Radeon Series of cards was updated in later releases of the fglrx driver. Which can be enabled in 5 easy steps.

1. Remove all references to the older fglrx driver.

sudo apt-get remove xorg-driver-fglrx fglrx-kernel-source

2.Update the sources list

sudo apt-get update

3. Reinstall the newer drivers

sudo apt-get install xorg-driver-fglrx fglrx-kernel-source jockey-gtk xserver-xorg-video-radeon

4. Enable the fglrx drivers

sudo aticonfig --initial

5. Restart gdm

sudo /etc/init.d/gdm restart

We can now verify that we have the right driver installed by using fglrxinfo.
osamad@root:~$ fglrxinfo
display: :0.0 screen: 0
OpenGL vendor string: ATI Technologies Inc.
OpenGL renderer string: ATI Radeon HD 2400 XT
OpenGL version string: 2.1.8087 Release

And voila, I then was able to launch the ATI Catalyst Control Center from the menu system Applications > Accessories
> ATI Catalyst Control Center , and used that to enable my dual monitors.

After that I enabled the desktop effects and installed the compizconfig-settings-manager
sudo apt-get install compizconfig-settings-manager
System > Preferences > Compiz Config Settings Manager to enable my desktop cube! And now am a happy camper!

Written by mnk0

November 6th, 2008 at 5:13 pm

Posted in Ubuntu

Tagged with ,

Using route , set your default gateway

without comments

Want to quickly set the route for your machine from the terminal.

Start by opening up a terminal window, and type the following, just make sure you have the ip address of your gateway to do so. In this case the gateway of 10.3.156.1 is being used.

route add default gw 10.3.156.1 eth0

We can see our changes by typing

route -n

Written by mnk0

October 24th, 2008 at 11:02 am

Posted in networking, shell

Bypass firewalls using ssh and tunnelling.

with 2 comments

Ever wanted to access a service behind a firewall that has port 22 open for ssh connections? This is a common setup known as using a jump-box for security access and to be successful at this we your firewall must allow port 22 traffic to your ssh jump-box. We can test our if port 22 is open by typing the following line.

telnet ssh-jump-box 22

If all is good then we should see something like
Trying 192.168.1.200...
Connected to ssh-jump-box.
Escape character is '^]'.
SSH-2.0-OpenSSH_4.7p1 Debian-8ubuntu1.2

In this example we’re going to create a tunnel for port 3389 windows rdekstop and we’ll begin by creating a local loopback port 3390 that ssh will tunnel from myMachine to myFireWalledMachine on port 3389

ssh -L 3390:server-behindFirewall:3389 user@ssh-jumpbox -N

Now we can access the service on port 3389 that was previously inaccessible through the firewall by pointing our connection to the local loopback port we just created through ssh. In this case we\’ll use rdesktop to hit that port as we are trying to remote desktop to a firewalled machine.

rdesktop localhost:3390

Written by mnk0

September 23rd, 2008 at 3:23 pm

Posted in ssh

Tagged with , , ,

Access a microsoft windows share from the bash terminal in Ubuntu Linux Desktop

with 2 comments

Setup

Ever want to access a windows share from your terminal? Well using ‘ mount ‘ and cifs/samba this is a snap.

Make sure you have smbfs/cifs support, on ubuntu linux distributions you can simply type
apt-get install smbfs
Now we need to make a directory on our hard disk where we can mount our windows share.
mkdir /mnt/location

Mounting Windows Share

Now we\’re ready to mount the filesystem on our newly created directory (/mnt/location).

Mount with cifs
mount -t cifs //server-ip-or-name/share /mnt/location -o username=user,password=pass,domain=DOMAIN
Mount with smbfs
mount -t smbfs //server-ip-or-name/share /mnt/location -o username=user,password=pass,domain=DOMAIN

Clean Up

When finished with our windows mount, we should exit the directory, or close any windows that are accessing it, and then unmount the Microsoft Windows NTFS share by using the following series of commands.

cd /; umount /mnt/location

Written by mnk0

September 22nd, 2008 at 4:02 pm

Using find to search files on your system

without comments

Looking for something? Find has all the power you’ll need to locate any file or directory on your system, as long as you know the name of what you’re trying to find. :)

First you’ll need to launch a terminal session, and then we’ll dive into this by typing the following command.

find / -name 'my-file.txt' 2>/dev/null

Breaking down our ‘ find ‘ command

  • ‘ / ‘ - is our search location, since we’re using / it’ll search everything on our root partition
  • ‘ -name ‘ - says we’re gonna search by name, and we can type anything in here (* wildcard)
  • ‘ 2>/dev/null ‘ - will tell the shell to pipe all errors to dev/null meaning they wont be displayed

Written by mnk0

September 19th, 2008 at 11:37 pm

Posted in shell

Tagged with , ,