Wednesday, June 19, 2013

How to set static IP linux

1. Open /etc/network/interfaces

there will be written something like this
auto lo
iface lo inet loopback
 
Change text like this

auto lo eth0
iface lo inet loopback
iface eth0 inet static
        address xxx.xxx.xxx.xxx(this is your ip)
        netmask xxx.xxx.xxx.xxx(this is your mask)
        gateway xxx.xxx.xxx.xxx(this is your gateway)

Compres/Extract archives in linux

1. Compress/Extract tar archive in linux
Compress tar -cvf name.tar /path
Extract tar -xvf name.tar

2. Compress/Extract tar.bz2 archive in linux
Compress tar cjf name.tar.bz2 /path
Extract tar -xvjf name.tar.bz2

3. Compress tar.gz archive in linux
Compress tar -pczf name.tar.gz /path
Extract tar -xzvf name.tar.gz

4. Compress tar.xz archive in linux
Compress tar cJf name.tar.xz /path
Extract tar -xf name.tar.xz

5. Compress tar.7z archive in linux
Compress tar cf - /path | 7zr a -si name.tar.7z
Extract 7zr x name.tar.7z

6. Compress .7z archive in linux
Compress 7zr a -t7z name.7z /path
Extract 7zr x name.7z

Tuesday, June 11, 2013

Linux startup messages

For change pre-login message Linux you must edit file /etc/issue
For change post-login message Linux you must edit file /etc/motd

Also you must to edit file /etc/login.defs, uncomment lines MOTD_FILE and ISSUE_FILE

Where is located start up directory

All start up services located in /etc/init.d

How to add start up service linux gentoo

All start up services located in /etc/init.d
You can create executable file in /etc/init.d, for example execute.sh after that run this command
rc-update add execute.sh

If you want to delete any service from start up, you must run command

rc-update delete some-service

And finally you can see all services

rc-update show

Sunday, June 9, 2013

How to chroot arm file system

For chrooting in arm file system, first off all you must install the qemu-user-static package. In ubuntu type
1. sudo apt-get install qemu-user-static

2. sudo qemu-debootstrap --arch armel precise arm-for-chroot
Command will be create directory  arm-for-chroot.

3. In file arm-for-chroot/etc/sources.list type
deb http://ports.ubuntu.com/ubuntu-ports/ precise main
deb http://ports.ubuntu.com/ubuntu-ports/ precise universe

4. Now you can chroot from your system in arm-for-chroot arm system.

If you already have another arm file system, you can copy all binary files from directory arm-for-chroot/usr/bin/qemu-* to your file system usr/bin/ and after that you can chroot from your system to arm system.



How to open X programs inside chroot

1. You must have Xnest program. In Ubuntu type
sudo apt-get install xnest

2. Run "Xnest -ac :1". Program Xnest will be opened.

3. In other terminal chroot where you want to chroot

4. From chrooted location type "export DISPLAY=localhost:1"

Now you should be able to open any x application. Type "xterm" for example