the LYNCH report

The Power of Clear Insight

Quick Reference Sheet for Ubuntu/Linux…

leave a comment »

***LATEST UPDATE: AUG 10, 2008***

We’ve compiled a table of some useful commands we’ve come across as we continue to learn Linux/Ubuntu – see below. You can open the link with OpenOfficeOrg (which may show up as “soffice” in the download dialogue box or you may have to click “Open With Other Application” and navigate to /usr/bin/soffice).

We’ll be adding to these regularly – so be sure to check back often!

click here to download

System/Program Affected

Error Message/Symptom

Solution

DVD Drive – can’t mount mount_point cannot contain the following characters: newline, G_DIR_SEPARATOR (usually /)
In a terminal #gconf-editor
then click “system” then “storage” then “drives” then “_org_freedesk…”
Change the value for “mount_point” from “/dev/hda” to simlpy “hda”. May require reinserting the disc.
Firewire capture from STB (Motorola 6200) fails Black screen appears when watching live TV in MythTV.
In terminal (this is one line):
#sudo /folder/name/./firewire_tester -B -P 0 -n 0 -r 5
where:
P = port
n= node
B = repair broadcast connection. This can also be “p” for point-to-point or “b” for test broadcast connection.
In terminal, use #plugreport
to find port and node
No live TV in MythTV Selecting live TV in MythTV causes a very brief flash followed by a return to main menu screen.
STB has frozen (usually on reboot of computer) and GUID no longer matches setting in mythtv-setup.
Unplug and replug STB, then:
In terminal: #mythtv-setup
-Delete all capture cards
– Add new capture card (firewire, broadcast, 400 mps; GUID must show or unplug and replug STB, then try again).
– Add video source
qjackctl won’t start – error box pops up after attempting to start Need to force bus reset
In terminal: #gscanbus
Click “Force Bus Reset”
Restart qjackctl.
Ardour interrupts recording/ playback with “Disk Cannot Keep Up…” Possibly too many overlapping regions. Delete un-needed regions until it works again.*see ardour.org for non-destructive methods.
Want to download a torrent file. Use Bit Torrent In terminal:#gnome-btdownload http://www.link_to_torrent
Process can’t get the priority you want/is pre-empted by other, less important processes
In terminal:
#sudo chrt -f -p 99 3359
where “3359” is the PID of the process whose priority you’re altering (use ps -e to find this – see above) and “-p 99” is the priority you’re assigning the process, from 0-99, where 99 is the highest priority.
Convert .wav to .mp3 #lame -V2 /path/to/song/.wav /path/to/put_new_mp3_song.mp3
Convert all files in a folder from .aif/.aiff to .wav
Create a text file with the following:
#!/bin/bash
#
# Usage: convertowav fileextention
#
if [ $1 = “” ];then
echo ‘Please give an audio file extention as argument.’
exit 1
fi
for i in *.$1
do
if [ -f “$i” ]; then
rm -f “$i.wav”
mkfifo “$i.wav”
mplayer \
-quiet \
-vo null \
-vc dummy \
-af volume=0,resample=44100:0:1 \
-ao pcm:waveheader:file=”$i.wav” “$i” &
dest=`echo “$i”|sed -e “s/$1$/wav/”`
lame -V0 -h -b 160 –vbr-new “$i.wav” “$dest”
rm -f “$i.wav”
fi
done
Copy this file to the folder with your aif/aiff files, navigate to the folder and type:
#./converttowav aif
Manually transcode MythTv recordings see: http://www.mythtv.org/docs/mythtv-HOWTO-23.html
List all current users – check if anyone is logged on who shouldn’t be Informational/security #w
List all open network files – check if files are opened which shouldn’t be Informational/security #lsof -i
Show details for all active connections Informational/security #sudo netstat -anp | less
Tools to scan for rootkits Security
#sudo chkrootkit
#sudo rkhunter
#sudo unhide proc
#sudo unhide sys
#sudo unhide brute
Show details of a PID Informational/security
#sudo ps -F -p <PID>
where <PID> is the process ID of the program you’re examining (use ps -e to find this – see above).
Show network connections, etc. Informational/security #sudo netstat -tulnp
Using the Uncomplicated Fire Wall (ufw) Security
#sudo ufw status
#sudo ufw enable
View all kernel parameters Informational #sudo sysctl -a | sort | more
In terminal, only show one page of info at a time (ie prevent scrolling)
add “ | more” to your command,
ie: #ls -l | more
the “|” is above the “\” key on most keyboards, ie Shift+\
Show last 500 commands entered in a shell terminal Informational
#history
To search for a previously used command, hit “Ctrl”+”r” and type in any part of the command you’re seeking.
If you know part of the command, you can also use:
#history | grep <part of name>
From the results returned by the “history” command, you can type “!” followed by the line number
of the command you want in order to repeat that command. Note that an <enter> is implied (ie you cannot modify the command: it will execute immediately). Example:
#!201
Narrow down search with “history”. Informational
#history | grep <part of command>
where <part of command> is, not surprisingly, part of the command you’re seeking.
Set up recurring jobs/programs to run automatically at set intervals Automation
#crontab -e
Format is:
# +---------------- minute (0 - 59)
# |  +------------- hour (0 - 23)
# |  |  +---------- day of month (1 - 31)
# |  |  |  +------- month (1 - 12)
# |  |  |  |  +---- day of week (0-6)(Sun=0 or 7)
# |  |  |  |  |
  *  *  *  *  *  command to be executed
Example (MUST be on one line):
27 * * * *  /usr/bin/chkrootkit >> /home/user/Desktop/security
Runs "chkrootkit" at 27 mins past the hour, every hour (and outputs the results to a file
called "security" on the user's desktop).
15 19 * * 3 /etc/init.d/mysql start
Starts mysql at 7:15pm every Wednesday.
 Also:

string            meaning
  ------                 -------
@reboot         Run once, at startup.
@yearly          Run once a year, "0 0 1 1 *".
@annually      (sames as @yearly)
@monthly       Run once a month, "0 0 1 * *".
@weekly        Run once a week, "0 0 * * 0".
@daily            Run once a day, "0 0 * * *".
@midnight      (same as @daily)
@hourly          Run once an hour, "0 * * * *".
Find IRQ of a device Informational #cat /proc/interrupts
Change the priority of an IRQ #sudo chrt -f -p 90 `pidof “IRQ-4″` where “-p” is the priority you want to assign, “-f” assigns it SCHED_FIFO (First In First Out scheduling) and “IRQ-4” is the IRQ of the device whose priority you want to change (use #cat /proc/interrupts to determine this). MAKE SURE YOU INCLUDE THE TICK MARKS IN THE COMMAND. THESE ARE NOT APOSTROPHES; THEY ARE TYPICALLY FOUND ON THE KEY ABOVE THE “TAB” KEY.
Firefox/Thunderbird won’t allow the installation of plugins/plugins stop working In the Profiles folder, delete the file “extensions.rdf”. Restart Firefox/Thunderbird – it will recreate the file and your extensions should work again.
Problem copying directory Error message: “cp: omitting directory …
In order to copy a directory and its contents, you must use the “-r” flag:
#cp -r /path/to/dir1 /path/to/dir2
where “dir1” is the directory you’re trying to copy and “dir2” is the copy of the directory.
Convert FLAC to WAV
In a terminal type:
#flac -d /path/to/filename.flac
Find orphaned MythTV recordings or database entries Recordings on disk but not available to mythtv or programs listed in mythtv but not available
In a terminal, navigate to your mythtv folder and look for the “contrib” folder. Once there, in the terminal, type:
#sudo ./myth.find_orphans.pl –dbhost=127.0.0.1 –pass=********
where “********” is your mysql password.
Google Notebook won’t open in Firefox Box appears, but “Reload” is displayed.
Conflict with Tor Button plug-in – disable Tor Button to resolve.
From the top menu bar, click Tools, then Add Ons. Select Disable and restart Firefox.
MySql won’t start after upgrade
MySql doesn’t start after booting; error message on attempted manual start (via:
#sudo /etc/init.d/mysql start):
error: “Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)’
Check that mysqld is running and that the socket: ‘/var/run/mysqld/mysqld.sock’ exists!
Check: /etc/mysql/my.cnf
A backup of this file (“my.cnf~”) should have been made during the upgrade. Try using the backup (note: the letters between each “#” constitute one line):
#sudo mv /etc/mysql/my.cnf /etc/mysql/my.cnf.upgrade
#sudo mv /etc/mysql/my.cnf~ /etc/mysql/my.cnf
#sudo /etc/init.d/mysql start
Test hard drive health using S.M.A.R.T.
Reports on health status of hard drives equipped with SMART technology. Install via Synaptic or (all on one line):
#sudo apt-get install smartmontools
1)Show all info about a drive:
#sudo smartctl -a /dev/sda
where “/dev/sda” is the path to the drive.
2)Start short self-test of drive:
#sudo smartctl –test=short /dev/sda
3)Get results of self-test:
#sudo smartctl -l selftest /dev/sda
4)Learn about meaning of output from 1) above:
http://smartmontools.sourceforge.net/faq.html#temp-seagate
NOTE: in most cases, the threshold value is the LOWEST the value should go. For more details, go here:
http://en.wikipedia.org/wiki/S.M.A.R.T.
5)Quick check of drive health:
#sudo smartctl –health /dev/sda
Get info about hard drive Informational
#sudo hdparm -I /dev/sda
where “/dev/sda” is the path to the drive.
Test performance of hard drive Informational
#sudo hdparm -tT /dev/sda
where “/dev/sda” is the path to the drive.
Reasonable results? Seagate 320Gb @7200RPM:
Timing cached reads: 1567MB/s
Timing buffered reads: 74MB/s

***UPDATE***

Well, it didn’t take long for me to stumble upon a MUCH more comprehensive guide – you can find it here:

http://blog.lxpages.com/ultimate_linux.html

Cheers!

Written by westcoastsuccess

March 23, 2008 at 2:18 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: