Ubuntu Tips and Hints

Aus Peter Fuerholz' Wiki
Version vom 13. Oktober 2018, 22:37 Uhr von Admin (Diskussion | Beiträge) (→‎Helpful commands)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Zur Navigation springen Zur Suche springen

Key bindings in GNOME

Alt-F2
Run Application -> runs application in a shell or as GUI application
Ctrl-L : Open Location -> opens Nautilus at configured file path (Doesn't work anymore...)
Places, Home Folder to always open a new window
see here:
  • gksudo nautilus /usr/share/applications/, goto the 2 'Files'
  • have following command shown in both properties: nautilus --new-window %U
Ctrl-Alt-F1..6
Switch to a console (no X-windows!)
Ctrl-Alt-F7
Switch to X-window server (switching X server could be helpful if you have a problem with your graphics card driver)

How To's

change bookmarks under 'Places'
Open Nautilus, 'Bookmarks', 'Edit Bookmarks...'

Helpful packages to install

This enumeration were created when installing Dell Inspiron 510m

Solve Graphics Problems with Ubuntu 8.04 (Dell Latitude E6510 / Dell Inspiron 510m)
Meld is tool for comparing and merging text files.
Gnome Commander is a good clone of Norton Commander; install package gnome-commander (Gnome Commander uses Meld as default compare tool.)
Open as Administrator in Nautilus
nautilus gksu adds an 'Open as Administrator'-action in the context-sensitive menu. Therefore console is not anymore needed to edit a file as admin.
Package smbfs for SMB mounting (see below)
Package ImageMagick for image manipulation on the command line.
Packages for OpenOffice (among others)
  • openoffice.org-filter-binfilterfor importing Star Office documents / spreadsheets (restart Open Office necessary)
  • openoffice.org-base database module, needed for e.g. exporting to dbase-files
Adobe Reader
Go to www.adobe.com, download .deb package, install deb with sudo dpkg -i AdobeReader<Version-id>.deb. Program should appear in the menu below Applications, Office...
Update Settings: 'Edit', 'Preferences...', Tab 'Internet', Browser Executable: usr/bin/firefox, libgtkembedmoz: usr/lib/xulrunner
Skype
Go to www.skype.com, download .deb package, install deb with sudo dpkg -i skype-debian<Version-id>.deb. Program should appear in the menu below Applications, Internet... .
Then you have to set up the correct sound devices: Options, Sound Devices (correct values for my laptop):
  • Sound in: Intel 828001DB-ICH4 (hw:I82801DBICH4,0)
  • Sound out: pulse
  • Ringing: pulse
Simple Backup Restore sbackup
Simple backup tool. See [1]. Do remember:
  • backup process do not follow softlinks
  • supports full and incremental backup (do fullback after ..days)
  • different backup configurations possible on the command line
For ripping CDs into MP3 with Sound Juicer (defaultly installed) you need following packages
  • lame (multiverse)
  • gstreamer0.10-plugins-ugly (universe)
  • gstreamer0.10-plugins-ugly-multiverse (multiverse)
See Sound Juicer for more information. Alternative tool for CD ripping is grip.
After changes any presets in Sound Juicer you have to restart it.
adobe-flashplugin
for watching flash-videos
bless
Hex-Editor
tofrodos
delivers dos2unix and unix2dos tools to convert files (CR/LF)
SmartMonTools
Tools for checking the state of the harddisk
Official documentation / Usage
self assessment test: sudo smartctl -d ata -H /dev/sda; Overview: smartctl -d ata -a /dev/sda
extended self test: sudo smartctl -d ata -t long /dev/sda (takes almost an hour); Result of selftest: sudo smartctl -l selftest

Diverse:

ffmpeg
for converting movies (*.mov, *.gp3 etc.) to Flash. For good conversion quality: ffmpeg -i P3054383.MOV -ar 22050 -sameq P3054383_sameq.flv
nmap and nmapsi4
Enables to look up used local IP addresses, e.g.: nmap -sP 192.168.178.0/24, nmpasi4 is a graphical user frontend for nmap
gparted
Gnu Partition Tool
partimage
Tool for saving and restoring harddisk partitions.
b43-fwcutter
If you have a Broadcom B43 wireless network chip in your laptop
Uninstall application
sudo dpkg -r <Application Name (e.g. realplayer)>

Video / Audio

With following tool you can test and configure some parameters of the v4l-driver: gstreamer-properties. See e.g. Error-Handling See following links to see a list of supported webcams: Supported by Ubuntu and FSF-supported cams. I bought a camera of the FSF-supported cams, pluged it in and it was instantly available in e.g. Skype. Install following packages for further usage:

cheese
Simple and good tool for your cam.
cameramonitor
icon in system tray shows if camera is on/off
xawt
(Below others) shows camera on desktop. Homepage
Cinelerra
Download from Download Cinelerra, unzip it, then start with ./cinelerra
Put following lines into gksudo gedit /etc/sysctl.conf (needs restart to take effect):
# needed by Cinelerra
kernel.shmmax = 0x7fffffff
Cinelerra is a rather complicated tool to use, so I recommend using:
Kdenlive
A rather easy to use movie authoring tool. Powerful and easy to use.
luvcview
A very simple but also fast tool for video / picture grabbing of your webcam is luvcview. Install via Synaptic and start on the shell with luvcview.
WebcamStudio
Download from WebCamStudio Seems really good software!
DVD slideshow
Looks really powerful, but haven't yet used. E.g. allows to zoom and pan a picture known as the Ken-Burns effect.

Screencasts

Install 'recordmydesktop', it is really easy. See: [2]

Helpful commands

find
Finds a file according to its name or specific parameter. E.g. -name <name pattern, e.g. *.deb>.
-iname for case insensitive
-regex for regular expressions, -iregex for case-insensitive regex
If your regular expression does not work try -regextype posix-extended, e.g. for: find . -regextype posix-extended -regex ".*\.(java|groovy)"
grep
Finds a file according its content. E.g. -r "<search-string>" ..
-i for ignore case
-v for invert match
-F can be used instead of -r to look for fixed string
-H with filename
-H with line number
find and grep
  • Seek java file recursively under current directory containing 'foo': find . -iname "*.java" -exec grep -Hn "foo" {} \;
filename, line number and text line will be printed of each occurence.
('{} \;' belongs to the find command)
See [3] (There are other variants for this as well.)
tr
Replace characters. E.g. for replacing all ASCII-00-values with a carriage return type tr "\00" "\n" <flist >flist_alined
File flist_alined is the output of the transformed flist file.
wget -r --level=1 <URL>
Download a whole internet page including referenced links (r=recursion). The page is downloaded in its own directory and subdirectories.
sudo apt-get update
If Synaptic package manager cannot be started and the icon in the top toolbar shows an "entry forbidden"-sign try this command. (Error in Syslog was: Apr 23 20:04:42 pfu-laptop kernel: [ 2358.225170] update-manager[9029]: segfault at bcc74ca8 ip b6b1d5b0 sp bffc3960 error 4 in libapt-pkg-libc6.8-6.so.4.6.0[b6ae7000+bf000]
readlink -f <soft-link>
Shows link target, see here
rename multiple files with regex
Example replacing all spaces by underscores in a directory ('-n' is used for 'no clobber: don't overwrite existing files'):
 for file in * ; do mv -n "$file" "`echo $file | sed 's/ /_/g'`" ; done

Set global environment variables

See e.g. [4] (OLD: [5] and [6])

  1. Open file /etc/environment:
    sudo gedit /etc/environment
  2. Put in something like:
  3. Update environment variabled for Java and Groovy:
    export JAVA_HOME=/usr/lib/jvm/java-6-sun
    export GROOVY_HOME=/usr/share/groovy
    export ANT_HOME=/usr/share/groovy/bin
  4. Relogon/restart PC

Add path to PATH variable

See [7] -> Edit /etc/environment by adding the path to PATH.

Do mind that PATH=$PATH:<add. path> does generally work but not when put in file environment. (Reason?) In this case you are unable to relogin since PATH is destroyed and most commands cannot be found! (In this case you have to restart your PC with a Linux on CD-ROM and fix the file environment ;-(

Install Microsoft TrueType Fonts

See [8]

  • Start Synaptic Package Manager, Seek for msttcorefonts, install
  • To configure fonts, install x-ttcidfont-conf as well (Installation is done automatically, if you press forward in the dialog) and see /usr/share/doc/x-ttcidfont-conf. (I haven't done any configuration...)

Install fonts manually

See [9]

  1. alt-F2, enter gksu nautilus /usr/share/fonts/truetype
  2. create directory, e.g. my-windows-fonts
  3. copy files from /media/ntfs/WINDOWS/Fonts to newly created directory (but do not add the ones installed already via msttcorefonts; alternatively you can copy them from e.g. a CorelDraw-CD.
  4. Alt-F2, enter sudo fc-cache -f -v
  5. Restart Open Office from ground up

Use Wine

  1. install Wine (adding specific repository deb http://wine.sourceforge.net/apt binary/ did not lead to newer version)
  2. start Wine configuration, add application
  3. Added to /home/pfu/.wine/drive_c/windows/system32 for mv-soft.exe following dlls:
    crpe32.dll, mfc42.dll, implode.dll (all from C:/Windows/system32)
  4. Added to /home/pfu/.wine/drive_c/windows/system32 for mv-soft following dlls:
    crpe32.dll, mfc42.dll, implode.dll (all from C:/Windows/system32)
  5. For crw32.exe (Crystal Report):
    Requested P2BXBSE.DLL, copied C:/windows/crystal into .wine/Windows -> Windows/crystal

Open Office

  • Templates are placed in directory: /home/pfu/.openoffice.org2/user/template

Set the computer name (hostname / DNS)

See [10]

Update the DNS-server with the computer's hostname

Ubuntu seems not to update the DNS server from ground up. Configure /etc/dhcp3/dhclient.conf and add following line after send host ...:

send fqdn.server-update on;

See for more info: [11] (parker13)

Does not work in my configuration...

Mounting NTFS-partitions

  1. sudo mkdir /mnt/ntfs
  2. sudo gedit /etc/fstab
  3. Add the following line:
/dev/sda2 /mnt/ntfs ntfs defaults 0 0
  1. Call (automatically done on PC-restart): mount /mnt/ntfs

Mounting N3200/photos (via SMB/CIFS)

  • Requirement: Package smbfs must be installed.
  • Assert content of /etc/hosts is OK: (Is problem if error message 'sudo: unable to resolve host ..' appears.):
    127.0.0.1 localhost
    # replaced by next line on Nov 30, 2008 due to mount-problem: 127.0.1.1 pfu-laptop.peterfuerholz
    127.0.1.1 pfu-laptop
    ...
  • Do the mounting:
  1. sudo mkdir /mnt/N3200Photos (needed only once)
  2. sudo mount -o user=<user>%<pw>,users,noperm //n3200/photos /mnt/N3200Photos
users is used, so that common user can access n3200
Mounting as user and executing scripts on it only works for mounted drives if user is user of it. See [12]
  • Unmount: sudo umount /mnt/N3200Photos

Line in fstab (see above): //N3200/music /mnt/N3200Music cifs user=<user>%<password>,user,noperm 0 0 Add ,exec after noperm to e.g. execute shell scripts on this drive.

Connecting Sony Ericcson C902

  • Connect via USB: On C902 choose: "Medienwiederg."
  • Popup in Ubuntu appears: Select shown item. C902 is now mounted
MountC902.png
  • SIM card and memory card appear as separate directories, e.g. gphoto2://[usb:001,014]/store_00010001 and gphoto2://[usb:001,014]/store_00020001.
  • photos are stored below store_00020001/DCIM/100MSDCF

Alternative:

  • Seems not simple to mount into filesystem. See [13]
  • Workable solution: Install wammu. There you can copy one file after the other. .mp3-files are copied automatically into the music directory.
Configuration:
WammuC902.png

Networking

When replacing the network connection of a Linux computer, the OS does not automatically acquire a new IP-address.
Call sudo dhclient to acquire an IP-address of new IP-subnet. If you startup the computer, it acquires the IP-address automatically (if DHCP is on).
Bring Broadcom B43 wireless chip to work
Install package b43-fwcutter. Check 'System', 'Administration', 'Hardware Drivers' to check, if your wireless driver is into work.

Connecting a second display, e.g. a beamer

See:

Thus:

  • gksudo nvidia-settings
  • Detect displays, save,
  • edit configuration:
  • Under: Section "Device" Identifier "Device1"
Option "Rotate" "CCW"Option
  • set LeftTo instead of RightTo (if appropriate)
  • restart computer

With Dell Inspiron:

If I connect a second screen / beamer to my laptop, if have to select the *mirror*-checkbox in my 'Monitor Resolution Settings'. Otherwise I get asked to login again and then the X-server does not run properly.

Printer driver

Best experiences have been made by downloading the ppd-files from the manufacterers home pages:

Selected Driver for Debian GNU/Linux 3.1 systems, download as deb-file.
Manual
Then add new printer via 'System', 'Administration', 'Printing' and provide the downloaded ppd file: use the one under UTF-8/en.
Remark: Under Windows, the Port must be connected with address 'C530.'.
Download file and run it via shell. This installs something like the CUPS-print system. PC needs be rebooted afterwards.


Evolution Email Client

If you are in need to copy emails from an existing Evolution client to another, you can copy saved emails from following place: /home/pfu/.evolution/mail/local. Each folder uses up to four different files (meta-data etc.).

Mount share from other computer

  • Share directory: Nautilus, select directory, right-mouse-click, Share: define name (optionally packages need be installed and Samba started)
    • If you want to share mounted shares (e.g. a Windows partition) you need to add following text to the [global] section in file /etc/samba/smb.conf:
 # allow sharing of e.g. ntfsdata-share:
    usershare owner only = false
(no restart necessary)
See [14] for more information.
  • Connect it: 'Places', 'Connect to server': 'Windows Share', 'pfu-laptop.fritz.box', log on as you would on the remote server

Name the volume of a memory stick

There seem to be different solutions to this (see [15])

A solution without needing the command line is the following:

  • Start GParted
  • Plug in Memory Stick
  • in GParted, select 'GParted', 'Refresh Devices', then select 'GParted', 'Devices', '/dev/sdb'
  • select partition '/dev/sdb1', right-mouse click, 'label', enter a name (11 characters which get capitalized)
  • 'Apply all operation'
  • Finish


Open file with default application

Can be done with xdg-open or gnome-open (but I don't know the real differences...) See [16]


Chrome

If Chrome shows black content only switch off hardware acceleration (happened in my case on one of the two screens only):

  • Go to the Costumize and control icon at the top-right of chromium (the triple bar icon)
  • Choose Settings
  • Choose Show Advanced Settings
  • Look for "System"
  • Untick "use hardware acceleration when available"