Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Tuesday, March 22, 2016

Flash Plugin - Keep it up to date and troubleshoot problems

Link.

1. Download the  Flash Player (*.tar.gz)
2. Extract the libflashplayer.so and also the /usr files
3. Copy files to the corresponding location
$ sudo cp libflashplayer.so /usr/lib/mozilla/plugins
$ sudo cp -r usr/* /usr
Read more ...

Monday, March 21, 2016

Install Adobe Reader 9 in Debian (also chinese font)

Install Adobe Reader 9

1. Go to FTP download site on Adobe and download the version you wish to install.
2. Install architecture: i386
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libgtk2.0-0:i386 libxml2:i386 libstdc++6:i386
3. Install Adobe Reader which you downloaded
sudo dpkg -i AdbeRdr9*.deb
4. If the installation doesn’t fully complete, you might need to do
sudo apt-get -f install

Install Chinese Font

1. Download Font from here.
2. Unzip and install the font.
tar xvf FontPack910_chs_i486-linux.tar.bz2
cd CHTKIT
sudo ./INSTALL
Read more ...

Friday, August 29, 2014

Split and merge pdf’s with pdftk in linux

Link.


Pdf Tolkit (pdftk) is a tool to split and merge the pdf’s.

First you need to install the pdftk with following command.
$ sudo apt-get install pdftk

An example to merge pdf’s
$ pdftk input1.pdf input2.pdf cat output merge-output.pdf

Above example is to merge input1.pdf and input2.pdf and create new output file with name merge-output.pdf

An example to split pdf(split from page 10 to 20)
$ pdftk A=input1.pdf cat A10-20 outpout split-output.pdf

Above example is to get only page number 10 to 20 from input1.pdf to split-output.pdf
Read more ...

Monday, August 18, 2014

Converting mp4 to mp3 in Linux

Link.


To convert Upd_Sanity.mp4 to Upd_Sanity.mp3

$ sudo apt-get install ffmpeg && sudo apt-get install libavcodec-extra-53

$ ffmpeg -i Upd_Sanity.mp4 -vn -acodec libmp3lame -ac 2 -ab 160k -ar 48000 Upd_Sanity.mp3
OR (as ffmpeg is deprecated)
$ avconv -i Upd_Sanity.mp4 -vn -acodec libmp3lame -ac 2 -ab 160k -ar 48000 Upd_Sanity.mp3

Description

   -i        input file name
   -vn       disable video recording
   -acodec   force audio codec to libmp3lame
   -ac       set the number of audio channels
   -ar       set the audio sampling frequency

If you need to use it frequently,

STEP 1 : Create a bash function that performs conversion
## utilities.sh
convertMP4toMP3(){
echo -n "Enter source mp4 file : "
read sourceFile

echo -n "Enter destination mp3 file : "
read destFile

avconv -i $sourceFile -vn -acodec libmp3lame -ac 2 -ab 160k -ar 48000 $destFile
}
STEP 2 : source that bash file
 $ source utilities.sh
STEP 3 : start conversion calling above function convertMP4toMP3
 $ convertMP4toMP3
 Enter source mp4 file : Upd_Sanity.mp4
 Enter destination mp3 file : UPd_sanity.mp3
Read more ...

Monday, July 21, 2014

Install Android 4.4 Kitkat on PC or Virtualbox

Follow this LINK to install it.

Change the resolution:



DOWNLOAD AND INSTALL ANDROID
1. I Downloaded Android from: http://www.android-x86.org/download - look for "Android-x86-4.4" folder and click on View link to start downloading iso image.

2. Install Android according to the HowToGeek tutorial: http://www.howtogeek.com/164570/how-to- ... irtualbox/
Note: I have selected NAT network and "Adapter Type": PCnet-FAST III


RESIZE SCREEN
3. On VirtualBox Ubuntu host I have executed command:
CODE: SELECT ALL   EXPAND VIEW
VBoxManage setextradata "MY_ANDROID_VIRTUAL_MACHINE_NAME" "CustomVideoMode1" "1680x1050x16"

Details: https://stackoverflow.com/questions/923 ... irtual-box

4. Start Android virtual machine.

5. From grub menu select "Live CD - Debug mode" to get into debug mode.

6. Create directory:
Details for steps 6 to 12: http://satoricode.net/2011/10/16/HighSp ... idx86.aspx
CODE: SELECT ALL   EXPAND VIEW
mkdir /boot

7. Mount disk to /boot directory:
CODE: SELECT ALL   EXPAND VIEW
mount /dev/sda1 /boot

8. Edit grub menu.lst file
CODE: SELECT ALL   EXPAND VIEW
vi /boot/grub/menu.lst

9. In the first "kernel" line search for text
video=-16 SRC=/android-4.4-RC1
and add text to become:
video=-16 UVESA_MODE=1680x1050 SRC=/android-4.4-RC1

Text in bold was added.
Details: https://stackoverflow.com/questions/923 ... irtual-box

10. Save file and exit the vi editor with command: :wq

11. Unmount /boot directory
CODE: SELECT ALL   EXPAND VIEW
umount /boot

12. Delete /boot directory
CODE: SELECT ALL   EXPAND VIEW
rmdir /boot

13. From VirtualBox power-off the Android virtual machine guest.

14. Start Android and new screen resolution should be working fine.
That's it.
Read more ...

Tuesday, April 1, 2014

Set a Partition As Active on Linux


  1. fdisk /dev/hda (Replace "/dev/hda" with the Linux name of the device where the partition is contained.)
  2. Type "a" into the active "fdisk" prompt, then press "Enter." fdisk will prompt you for the number of the partition whose bootable flag you want to set; enter it, then press "Enter."
  3. Type "w" and press "Enter." fdisk will save your modification to the partition table and exit. At that point, your partition will have been marked as active.
Read more ...

Friday, February 14, 2014

Ubuntu/Debian 下提取 dsdt/ssdt

Ubuntu/Debian中/proc/acpi/没有 dsdt这个文件 

提取步骤应该如下(:


sudo apt-get install acpidump iasl
sudo acpidump -t DSDT -b > dsdt.aml
sudo acpidump -t SSDT -b > ssdt.aml
sudo acpidump -t SSDT -b –skip 1 > ssdt-1.aml
sudo acpidump -t SSDT -b –skip 2 > ssde-2.aml
chmod 755 *.aml
Read more ...

SSH Login Without Password

Link.

1. Create public and private keys using ssh-key-gen on local-host

ssh-keygen

2. Copy the public key to remote-host using ssh-copy-id

ssh-copy-id -i ~/.ssh/id_rsa.pub remote-host
Read more ...

Wednesday, November 27, 2013

Convert from pdf to djvu on Linux

One of the main reasons to convert a pdf file into djvu file is to save space.


on Linux:

sudo apt-get install pdf2djvu
pdf2djvu -o output_file input_file

If you want to convert djvu to pdf, then you have to install a package from here.
Read more ...

Wednesday, August 14, 2013

Monday, July 15, 2013

Cut or trim mp3 files with Linux

Link.


We are going to see two different options:

1. mpgtx
To install this program under Debian
$ sudo aptitude install mpgtx
Now if you want to trim a mp3 file into 10 pieces just enter this command
mpgtx -10 input.mp3 -o output
You will get output01.mp3, output02.mp3 .... output10.mp3 files, and now you can easily transport them, use them as ringtones, or anything you need.
Now if you want to cut an specific part of the mp3 file you may use ranges:
$ mptsplit input.mp3 [00:00:20-00:00:58] -o output.mp3
Now you will have from the 20th second to the 58th second of the song, in output.mp3 file, which is great for creating ringtones for your cellular.
Read the man page for more options, as you can also join files and some other useful things.

2. mp3cut
First install the program, mp3cut is one tool, of the mp3 suite tools called poc-streamer, so lets install the suite of tools.
$ sudo aptitude install poc-streamer
Now to cut or trim the mp3 files, it works a lot like the first option in this article, lets try the same example.
$ mp3cut -o output.mp3 -t 00:00:20+000-00:00:58+000 input.mp3
This will have the same effect and you will get a resulting file containing the song from the 20th second to the 58th second.
Do not forget to check the man page, and also to hear to your resulting files also from the command line check out: mpg123
Read more ...

Tuesday, July 9, 2013

X Forwarding with Putty on Windows

Prerequisites

Configuring Putty
  1. Add Unix hostname/IP address
  2. Switch Protocol to SSH
  3. Type name of session in saved sessions
  4. Click 'Save'
  5. Expand the 'SSH' tab from the 'Category' list
  6. Choose 'X11' from 'SSH' list
  7. Check 'Enable X11 Forwarding'
  8. Put localhost:0 to X display location
  9. Choose 'Session' from 'Category' list
  10. Click 'Save'
Connecting
  1. Start Xming
  2. Start Putty
  3. Double click on the saved session you want
via: here

Read more ...

Thursday, June 27, 2013

Debian change default display manager and session

To change default display manager
$  sudo nano /etc/X11/default-display-manager

To change default session
$ update-alternatives --config x-session-manager
Read more ...

Wednesday, June 26, 2013

Linux command for username and group

Change or rename user name and UID (user-id)
# usermod -l <new_username> <old_username>
# usermod -u UID <username>

List username from a group
# getent group <groupname>

Remove username from a group
# gpasswd -d <username> <group>

Remove/Delete a user account
# userdel <username>
The following command will also remove user home directory
# userdel -r <username>

Add user to a group
# adduser <username> <group>
Read more ...

Control Volume with Keyboard Shortcut in Xfce

Add an Xfce shortcut by going to Applications > Settings > Keyboard.

Code for volume up/down/mute

amixer set Master 3%+
amixer set Master 3%-
amixer set Master toggle


Read more ...

Friday, June 21, 2013

Ubuntu/Debian 下安装 VirtualBox 虚拟 Win7

官方网站:http://www.virtualbox.org/

VirtualBox中虚拟Win7
运行Vbox
–》单击左上角New,新建虚拟环境。
–》填写名称和将要虚拟的操作系统版本。
–》然后是内存设置,默认即可,如果host主机内存够大,可以多设。
–》接下来虚拟硬盘,一路默认即可,最后确认,完成。

安装Win7
–》准备好系统镜像。win7.iso。
–》单击左上角Settings,会提示:Failed to access the USB subsystem.VirtualBox is not currently allowed to access USB devices. You can change this by adding your user to the ‘vboxusers’ group. Please see the user manual for a more detailed explanation.
将用户名添加到vboxusers组,重启或注销后即可解决。
sudo adduser usrname vboxusers
–》选择Storage,在看到IDE controler控制器下有硬盘和光盘, 光盘显示Empty,点击右侧Attributes属性中CD/DVD drive 右边的光盘图像,Set up the virtual CD/DVD drive,选择硬盘上下载的iso镜像文件,创建虚拟光驱。如果下面的步骤无法继续,在这里还可以尝试添加Sata 控制器。
–》设置好Storage点击Start 开始。接下来和普通安装Win7一样了。
–》安装完。优化设置,重新安装有问题的主板驱动;配置网络:如果无法上网,Settings中设置network从AMD换为intel(r) PR0/1000 MT Network Connection等,启动网卡驱动安装。

设置共享文件
Guest(win)
–》在Settings – Share Folders 点击+号新建共享文件夹,可选择Auto Mount 自动挂载。
–》点击顶部菜单设备device选项–Install Guest Additions,进行安装。
安装完毕,即可看到共享文件夹。

Guest(linux)

For linux guest, You may have to install following packages to complete Guest additions.

To dispaly the KERNELVERSION of the running distribution, you can use
uname -r

sudo apt-get install xserver-xorg xserver-xorg-core build-essential linux-headers-KERNELVERSION dkms
  1. sudo mkdir /media/shared  
  2. sudo mount.vboxsf Share /media/shared  
  3. sudo gedit /etc/fstab  
add the following into fstab:
Share /media/shared vboxsf rw 0 0
Share 为你要共享的文件夹 可以在settings里面设置。


支持USB
VirtualBox启用USB 2.0 必须安装:Oracle VM VirtualBox Extension Pack for Windows。在窗口顶部菜单File-Preferance-Extensions中添加下载的extpack。最后在Settings的usb选项中启用USB2.0,然后添加usb设备,即可。

摄像头驱动
同样在USB设置中添加摄像头。然后到虚拟的Win7里面安装相应驱动即可。
 
Read more ...

Set another viewer for auctex in emacs

>> Open an tex file;
>> LaTeX -> Customize AUCTeX -> Extend this menu;
>> Then LaTeX -> Customize AUCTeX -> TeX Command -> TeX Output View Style;
>> Find a line somehow like ''Extension: ^pdf";
>> Change Command to viewer you want. e.g. evince %o %(outpage) to okular %o %(outpage);
>> Click “Save for future sessions”.
Read more ...

Linux 下批量解压文件

find -maxdepth 1 -name "*.bz2" | xargs -i tar xvjf {}  
这条命令可解压当前目录下的所有bz2文件。maxdepth表示搜索深度,1代表只搜索当前目录。

find -maxdepth 1 -name "*.tar" | xargs -i tar xvf {}  
可解压tar文件。

find -maxdepth 1 -name "*.tar.gz" | xargs -i tar zxvf {}  
可解压tar.gz文件。
Read more ...

Linux 下批量去后缀加后缀

1. 删除所有的 .xml 后缀

$ rename 's/\.xml$//' *.xml  

2. 给当前目录下所有文件加后缀 .xml

for i in *  
   do mv $i $i".xml"  
done  
Read more ...

利用 ssh -X 登录服务器打开 xterm 等

>> 首先确保 /etc/ssh/sshd_config 中

X11Forwarding yes

>> 然后在 host 上 check DISPLAY

$ echo $DISPLAY

如果显示 

:0
继续输入

$ export DISPLAY=urworkstationIP:0.0

urworkstationIP 就是你想要显示 xterm 的客户端的IP。

>> 然后登录是使用

$ ssh -X host
Read more ...