I recently upgraded to ubuntu 13.04. Couldn't get enough things to work the way I wanted, and the way they used to be, and so subsequently backed up my home folder and reinstalled 12.10. Since I had to reinstall the psmouse-alps driver for my mouspad to work with a scroll I decided to blog about it.
I searched and the best answer I found was in this link. The answer I used I believe was the third one down. It was the one with the install.sh script in it.
First off, you need to have the right kernel stuff installed.(Yeah I know, really technical). Look in your /usr/src folder and see what kernel you are using. e.g. before I install the driver mine showed
linux-headers-3.5.0-17
if this is all that shows up(and it probably will be) you will need to install your specific kernel's generic package.. I ran
sudo apt-get install linux-headers-3.5.0-17-generic
To install it you will also need to have dkms installed you can simply:
sudo apt-get install dkms
Once all that is installed, download the alps driver. Here is the link(hopefully it doesn't change).
https://docs.google.com/open?id=0BzNsvDx_ae6bQnFLQkNFT0dWc3c
Uploaded it to my drive account too just in case.
https://docs.google.com/file/d/0BwdxaDKyG0KSWmpEaTZqUU9zMkk/edit?usp=sharing
Once downloaded, navigate to the directory in which you downloaded it. then:
sudo cp psmouse-alps-dst-0.4.tar /usr/src
cd /usr/src
sudo tar xvf psmouse-alps-dst-0.4.tar
after extracting the go into the source directory:
cd psmouse-alps-dst-0.4
The instructions the person on askubuntu gave was to simply run
sudo sh install.sh
for some reason this didn't work for me when I tried it and it required a few extra things to do after. I also need to run these commands each time I start the computer so I put it in a script. Open up your text editor of choice (vim) and write these lines:
#! /bin/bash
dkms add psmouse/alps-dst-0.4
dkms autoinstall
rmmod psmouse
modprobe psmouse
save the file, then make the file executable:
chmod 755 name_of_script
and run it:
sudo ./name_of_script
After that I simply went to System Settings->Mouse and Touchpad and then changed the settings as desired in the Mousepad tab (which wasn't there before).
Voila! And magically I could now enable multi-touch and scrolling with the mousepad.
This started as a place to write useful tricks with linux, mainly on the command line. Now lets just say it's another random tech blog.
Saturday, April 27, 2013
Sunday, April 21, 2013
Mounting USB in Ubuntu Server
So I put Plex Media Server on my laptop that I installed Ubuntu Server on for the purpose of only running Plex Media Server (the monitor broke). The only problem with hosting the media server is my laptop hard drive isn't big enough to hold my media library. It does however fit on an external USB drive (for now, though I might need a bigger one in not too long). So I decided to see if I could run it with the media library on the external drive. The only problem was mounting the drive. I realized I had no clue how to do that from the command line really. So I searched for a way to do this. The answer wasn't very difficult and was explained well on the ubuntu wiki here. just two commands:
sudo mkdir /media/external
To create a mount location and, since the drive was formatted with ntfs:
sudo mount -t ntfs-3g /dev/sdb1 /media/external
to mount the drive. To find out which device it is (in case it isn't sdb1) you can run
sudo fdisk -l
to find which one it is.
I tried pmount and various other tools but this one seemed to be the only one that really worked well and did what I wanted it to. I believe with it being ntfs it will give the user permission to the drive. Whereas if it was some type of fat system you would need to finish it off with the -o flag and some arguments.
And to unmount the drive (which I never really do since it is my library) you simply:
sudo umount /media/external
sudo mkdir /media/external
To create a mount location and, since the drive was formatted with ntfs:
sudo mount -t ntfs-3g /dev/sdb1 /media/external
to mount the drive. To find out which device it is (in case it isn't sdb1) you can run
sudo fdisk -l
to find which one it is.
I tried pmount and various other tools but this one seemed to be the only one that really worked well and did what I wanted it to. I believe with it being ntfs it will give the user permission to the drive. Whereas if it was some type of fat system you would need to finish it off with the -o flag and some arguments.
And to unmount the drive (which I never really do since it is my library) you simply:
sudo umount /media/external
Saturday, April 20, 2013
Listing sizes of stuff
Got to wondering how to show how big a file is, including all the files and folders inside of it. When one uses:
ls -l
to list files it will list every folder as size 4096 (or 4.0K if use use the -h flag as well). Well I'm pretty sure that I have more than 4KB of Music so I got looking for a way to show how big the file is. It was pretty easy to find. simply
du -hs /path/to/directory
the s flag is for summary, that way when you use the command it doesn't show the size of everything recursively, just the total.
Along with this stuff I was trying to see how to list the size of the whole drive and other partitions. One method was to use
sudo fdisk -l
but that only listed one partition for me, and didn't change the size to human readable form a much better command I found was df with the -h flag for human readable form thus
df -h
will list all partitions and their sizes, not just the one.
ls -l
to list files it will list every folder as size 4096 (or 4.0K if use use the -h flag as well). Well I'm pretty sure that I have more than 4KB of Music so I got looking for a way to show how big the file is. It was pretty easy to find. simply
du -hs /path/to/directory
the s flag is for summary, that way when you use the command it doesn't show the size of everything recursively, just the total.
Along with this stuff I was trying to see how to list the size of the whole drive and other partitions. One method was to use
sudo fdisk -l
but that only listed one partition for me, and didn't change the size to human readable form a much better command I found was df with the -h flag for human readable form thus
df -h
will list all partitions and their sizes, not just the one.
Wednesday, April 17, 2013
Playing a blu ray disk with Ubuntu 12.04/12.10/Mint 13
Found myself with a slight problem trying to play a blu ray disk on my laptop. crunched down, here is what I had to do to get it to work. Added a vlc repository, I'm not sure if this was necessary or if the following commands would have been sufficient but it's what I did.
sudo add-apt-repository ppa:n-muench/vlc
sudo apt-get update && sudo apt-get install vlc
I then had to install the correct codecs for blu ray
sudo apt-get install libaacs0 libbluray-bdj libbluray1
I then needed to create an aacs file and download a certificate/key.
mkdir -p ~/.config/aacs/
cd ~/.config/aacs/ && wget http://vlc-bluray.whoknowsmy.name/files/KEYDB.cfg
After that I simply opened up vlc (my prefered media player, especially for movies) went to Media>Open Disc...
Then I selected BluRay under Disc Selection, then in the dropdown menu I selected the correct device. I also read that it is important make sure the 'No disc menus' box is checked. Then hit play and enjoy the show!
sudo add-apt-repository ppa:n-muench/vlc
sudo apt-get update && sudo apt-get install vlc
I then had to install the correct codecs for blu ray
sudo apt-get install libaacs0 libbluray-bdj libbluray1
I then needed to create an aacs file and download a certificate/key.
mkdir -p ~/.config/aacs/
cd ~/.config/aacs/ && wget http://vlc-bluray.whoknowsmy.name/files/KEYDB.cfg
After that I simply opened up vlc (my prefered media player, especially for movies) went to Media>Open Disc...
Then I selected BluRay under Disc Selection, then in the dropdown menu I selected the correct device. I also read that it is important make sure the 'No disc menus' box is checked. Then hit play and enjoy the show!
Using avconv (previously ffmpeg) to record the desktop
So I was trying to figure out how to record a video of the screen. I didn't have much use for recording the microphone though. All the instructions I could find would always describe how to record a video using the microphone for audio. Here's that command for that just in case that's what you are wanting:
avconv -f alsa -i hw:0,0 -f x11grab -s 1600x900 -r 25 -i :0.0 -vcodec libx264 -acodec libmp3lame vid_file.mp4
Of course, since I didn't need microphone and I actually wanted the program's audio output, that command didn't work for me. I tried many different variations on the alsa device (hw:0,0) to no avail. Finally I found the answer somewhere was to change from using alsa to pulse, then directing to the device, eventually coming up with the command:
avconv -f pulse -i alsa_output.pci-0000_00_1b.0.analog-stereo.monitor -f x11grab -s 1600x900 -r 25 -i :2.0 -vcodec libx264 -acodec libmp3lame vid_file.mp4
The pulse device name (mine is shown as alsa_output.pci-0000_00_1b.0.analog-stereo.monitor) can by found with the command:
pactl list sources|less
Listed next to "Name:"
I'd also like to break down the command I used as best I can because nothing else I found explained much about what was going on or how the command worked and/or could be changed.
avconv is the name of the program
I believe -f is to add a new stream to the video/file so,
-f alsa/pulse
adds a new audio stream, then -i designates a device.
-f alsa -i hw:0,0
then adds alsa device hw:0,0.
then we use -f to add a video stream(no sound) with:
-f x11grab
-s for size which on my laptop is 1600x900.
-r I believe is the framerate.
-i then adds the device/display in this instance. Almost all the examples I saw used the display :0.0, after playing with it a bit I found that on my laptop it needed to be changed and was actually :2.0
so far we have:
avconv -f alsa -i hw:0,0 -f x11grab -s 1600x900 -r 25 -i :2.0
That takes care of where we get the input.
The rest of it is the output
-vcodec libx264 tells it to use x264 as the video codec (on of the most common and is used for mp4 files)
-acodec libmp3lame tells it to use mp3 encoding for the audio
vid_file.mp4 is the filename. (The extension tells it to save in an mp4 container)
avconv -f alsa -i hw:0,0 -f x11grab -s 1600x900 -r 25 -i :0.0 -vcodec libx264 -acodec libmp3lame vid_file.mp4
Of course, since I didn't need microphone and I actually wanted the program's audio output, that command didn't work for me. I tried many different variations on the alsa device (hw:0,0) to no avail. Finally I found the answer somewhere was to change from using alsa to pulse, then directing to the device, eventually coming up with the command:
avconv -f pulse -i alsa_output.pci-0000_00_1b.0.analog-stereo.monitor -f x11grab -s 1600x900 -r 25 -i :2.0 -vcodec libx264 -acodec libmp3lame vid_file.mp4
The pulse device name (mine is shown as alsa_output.pci-0000_00_1b.0.analog-stereo.monitor) can by found with the command:
pactl list sources|less
Listed next to "Name:"
I'd also like to break down the command I used as best I can because nothing else I found explained much about what was going on or how the command worked and/or could be changed.
avconv is the name of the program
I believe -f is to add a new stream to the video/file so,
-f alsa/pulse
adds a new audio stream, then -i designates a device.
-f alsa -i hw:0,0
then adds alsa device hw:0,0.
then we use -f to add a video stream(no sound) with:
-f x11grab
-s for size which on my laptop is 1600x900.
-r I believe is the framerate.
-i then adds the device/display in this instance. Almost all the examples I saw used the display :0.0, after playing with it a bit I found that on my laptop it needed to be changed and was actually :2.0
so far we have:
avconv -f alsa -i hw:0,0 -f x11grab -s 1600x900 -r 25 -i :2.0
That takes care of where we get the input.
The rest of it is the output
-vcodec libx264 tells it to use x264 as the video codec (on of the most common and is used for mp4 files)
-acodec libmp3lame tells it to use mp3 encoding for the audio
vid_file.mp4 is the filename. (The extension tells it to save in an mp4 container)
Monday, April 15, 2013
Useful IT commands
SSH
to connect to computer via ssh:
ssh username@host
to create tunnel
ssh username@host -L p1:h:p2
p1=local port (the port it is being directed to on local machine)
h=host machine, can be localhost(which will be remote machine) or machine accesible from original remote host(host)
p2=remote port, port on host machine(h) that is sending info
to be able to open up graphical applications on local computer
ssh -X username@host
to use ssh without needing a password:
first create an RSA key -
ssh-keygen
keep hitting enter for everything
will save key in ~/.ssh/
do this on both computers
then you need to send id_rsa.pub between computers. save in .ssh as authorized_keys
my preferred method (just one way, needs to be done on both)
cd ~/.ssh/
scp id_rsa.pub username@host:.
ssh username@host
cat id_rsa.pub >> ~/.ssh/authorized_keys
ARP
shows current/recent connections
arp -a
PING
sends packets (useful for checking network)
ping -c <#> <domain/ip>
-c for count without specific count will contiue until you tell it to stop
TRACEROUTE
traceroute <domain/ip>
will trace the route to specified destination and return ip's from each point along the way
WHOIS
whois <ip>
will return information about ip (like registration info)
NAT - to set up NAT on a gateway computer
sudo iptables -t nat -A POSTROUTING -o <network card:e.g. eth0> -j MASQUERADE
echo '1' | sudo tee /proc/sys/net/ipv4/ip_forward
DIG
shows dns servers, makes it possible to trace path one by one.
to connect to computer via ssh:
ssh username@host
to create tunnel
ssh username@host -L p1:h:p2
p1=local port (the port it is being directed to on local machine)
h=host machine, can be localhost(which will be remote machine) or machine accesible from original remote host(host)
p2=remote port, port on host machine(h) that is sending info
to be able to open up graphical applications on local computer
ssh -X username@host
to use ssh without needing a password:
first create an RSA key -
ssh-keygen
keep hitting enter for everything
will save key in ~/.ssh/
do this on both computers
then you need to send id_rsa.pub between computers. save in .ssh as authorized_keys
my preferred method (just one way, needs to be done on both)
cd ~/.ssh/
scp id_rsa.pub username@host:.
ssh username@host
cat id_rsa.pub >> ~/.ssh/authorized_keys
ARP
shows current/recent connections
arp -a
PING
sends packets (useful for checking network)
ping -c <#> <domain/ip>
-c for count without specific count will contiue until you tell it to stop
TRACEROUTE
traceroute <domain/ip>
will trace the route to specified destination and return ip's from each point along the way
WHOIS
whois <ip>
will return information about ip (like registration info)
NAT - to set up NAT on a gateway computer
sudo iptables -t nat -A POSTROUTING -o <network card:e.g. eth0> -j MASQUERADE
echo '1' | sudo tee /proc/sys/net/ipv4/ip_forward
DIG
shows dns servers, makes it possible to trace path one by one.
NMAP
nmap has various uses. my most recent = finding what other computers are on the network with me (and ip, or more specifically, just the ip)
nmap -sP 192.168.1.1-254
Worked great for me. you could also use
nmap -sP 192.168.1.1/24
These will show you the ip's that are up on your network. (well, on the 192.168.1.x network)
nmap has various uses. my most recent = finding what other computers are on the network with me (and ip, or more specifically, just the ip)
nmap -sP 192.168.1.1-254
Worked great for me. you could also use
nmap -sP 192.168.1.1/24
These will show you the ip's that are up on your network. (well, on the 192.168.1.x network)
Subscribe to:
Posts (Atom)