Difference between revisions of "Miscellaneous"

From Briki
Jump to: navigation, search
(Hardware)
(screen: Start a screen session with a title)
 
(61 intermediate revisions by 30 users not shown)
Line 1: Line 1:
== Ubuntu (Edgy) Starter Guide ==
+
== Find open files on mount ==
http://ubuntuguide.org/wiki/Ubuntu_Edgy
+
  sudo lsof +f -- /var/media
 +
Also useful in case you're trying to work out why an unmounted partition is still showing as 'in use' in tools like e2fsck:
 +
  sudo fuser -v -m /dev/sdX1
  
== Adding startup service ==
+
== List hardware details ==
To ensure a service which exists in /etc/init.d is run on startup, simply run:
 
 
<pre>
 
<pre>
sudo update-rc.d <service> defaults
+
sudo lshw -businfo
 
</pre>
 
</pre>
  
== Enabling Printing ==
+
== Add swap space ==
# /bin/chmod 06555 /usr/bin/lpr /usr/bin/lprm
+
* Create swap partition using ''fdisk''
# /sbin/chkconfig lpd on 
 
  
== Hardware ==
+
* Create swap filesystem
=== ATI Radeon on a custom kernel ===
 
Stock ubuntu kernels include the ATI kernel source, but if you've built the kernel yourself, you'll need to install this manually with
 
 
<pre>
 
<pre>
sudo apt-get install fglrx-kernel-source
+
sudo mkswap <device>
 
</pre>
 
</pre>
  
=== Logitech MX-1000 ===
+
* Activate swap
 
 
Add this section to your /etc/X11/xorg.conf:
 
 
<pre>
 
<pre>
Section "InputDevice"
+
sudo swapon <device>
        Identifier      "Logitech MX-1000"
 
        Driver          "evdev"
 
        Option          "CorePointer"
 
        Option          "Name"        "PS2++ Logitech MX Mouse"
 
        Option          "Buttons"        "20"
 
        Option          "ZAxisMapping"    "4 5"
 
EndSection
 
 
</pre>
 
</pre>
where "Name" is read from the relevant "Name" for your device in /proc/bus/input/devices. Then follow the remaining instructions in http://www.ubuntuforums.org/showthread.php?t=65471
 
  
Although this document describes the steps for a USB mouse, this also works when connected to the PS2 port. Note, however, that a Logitech MX-1000 forward and back keys are 8 and 9, and '''xvkbd''' is located in /usr/bin rather than /usr/X11R6/bin. In addition, as stated in the text, part 1.4 is unnecessary.
+
* Modify /etc/fstab to allow swap to be activated at boot time
  
In newer versions of X11, it seems that evdev is a driver rather than a protocol, so you'll need the line:
+
== Change userid/groupid for an existing user/group ==
<pre>
+
* Change groupid in /etc/group
Driver    "evdev"
+
* Run '''sudo grpconv''' to update /etc/gshadow
</pre>
+
* Change userid in /etc/passwd (and also the primary groupid for any changed groupids)
rather than
+
* Run '''sudo pwconv''' to update /etc/shadow
<pre>
 
Driver    "mouse"
 
Protocol  "evdev"
 
</pre>
 
  
Also, I needed to append "SendCoreEvents" to the Logitech line in the layout section
+
== Music Naming Strategy ==
 +
{| border="1"
 +
!Type!!Title!!TrackNum!!Artist!!Sort Artist!!Album Artist!!Sort Album Artist!!Album!!Sort Album!!Disc!!Genre!!Compilation
 +
|-
 +
!!!TIT2!!TRCK!!TPE1!!TSOP!!TPE2!!TSO2!!TALB!!TSOA!!TPOS!!TCON!!TCMP
 +
|-
 +
|Albums||Title||TrackNum||Artist||'''BLANK'''||''Directory1''||'''BLANK''' / ''Number word''||Album||''Directory2 [Disc n]''||Disc||Genre||'''BLANK'''
 +
|-
 +
|Compilations||Title||TrackNum||Artist||'''BLANK'''||'''Various Artists'''||'''ZZZD'''||Album||''Directory2 [Disc n]''||Disc||Genre||'''1'''
 +
|-
 +
|Singles||Title||'''BLANK'''||Artist||'''BLANK'''||'''Various Artists'''||'''ZZZH'''||'''Singles'''||'''BLANK'''||'''BLANK'''||Genre||'''1'''
 +
|-
 +
|Soundtracks||Title||TrackNum||Artist||'''BLANK'''||'''Various Artists'''||'''ZZZL'''||Album||''Directory2 [Disc n]''||Disc||'''Soundtrack (24)'''||'''1'''
 +
|-
 +
|Spoken||Title||TrackNum||Artist||'''BLANK'''||''Directory1''||'''ZZZP'''||Album||''Directory2 [Disc n]''||Disc||Genre||'''BLANK'''
 +
|-
 +
|Fun||Title||'''BLANK'''||Artist||'''BLANK'''||'''BLANK'''||'''ZZZT'''||'''Fun'''||'''BLANK'''||'''BLANK'''||'''Comedy (57)'''||'''1'''
 +
|}
  
== Convert m4a to mp3 ==
+
* '''Albums''': eyeD3 --to-v2.3 --set-text-frame="TSOP:" --set-text-frame="TPE2:$artist" --set-text-frame="TSO2:" --set-text-frame="TSOA:$album" --set-text-frame="TCMP:" $file
<pre>
+
* '''Compilations''': eyeD3 --to-v2.3 --set-text-frame="TSOP:" --set-text-frame="TPE2:Various Artists" --set-text-frame="TSO2:ZZZD" --set-text-frame="TSOA:$album" --set-text-frame="TCMP:1" $file
ffmpeg -ab <bitrate in kb/s> -i <inputfile> <outputfile>
+
* '''Singles''': eyeD3 --to-v2.3 --set-text-frame="TRCK:" --set-text-frame="TSOP:" --set-text-frame="TPE2:Various Artists" --set-text-frame="TSO2:ZZZH" --set-text-frame="TALB:Singles" --set-text-frame="TSOA:" --set-text-frame="TPOS:" --set-text-frame="TCMP:1" $file
</pre>
+
* '''Soundtracks''': eyeD3 --to-v2.3 --set-text-frame="TSOP:" --set-text-frame="TPE2:Various Artists" --set-text-frame="TSO2:ZZZL" --set-text-frame="TSOA:$album" --set-text-frame="TCMP:1" $file
Note: the error '''output buffer too small''' can be ignored.
 
  
 +
=== File Ownership ===
 +
* chown root:admin $file
 +
* chmod 664 $file
 +
* chown root:admin $dir
 +
* chmod 775 $dir
  
== Changing default ALSA soundcard ==
+
== Measuring LAN performance ==
 +
Host 1 (linux):
 
<pre>
 
<pre>
asoundconf list
+
iperf -s -p 8123
asoundconf set-default-card <cardname>
 
 
</pre>
 
</pre>
 
+
Host 2 (mac):
== List hardware details ==
 
<pre>
 
sudo lshw -businfo
 
</pre>
 
 
 
== Add swap space ==
 
* Create swap partition using ''fdisk''
 
 
 
* Create swap filesystem
 
<pre>
 
sudo mkswap <device>
 
</pre>
 
 
 
* Activate swap
 
 
<pre>
 
<pre>
sudo swapon <device>
+
~/bin/iperf -c host1 -p 8123
 
</pre>
 
</pre>
  
* Modify /etc/fstab to allow swap to be activated at boot time
+
== screen: Start a screen session with a title ==
 +
  screen -S <title>

Latest revision as of 07:59, 3 November 2021

Find open files on mount

 sudo lsof +f -- /var/media

Also useful in case you're trying to work out why an unmounted partition is still showing as 'in use' in tools like e2fsck:

 sudo fuser -v -m /dev/sdX1

List hardware details

sudo lshw -businfo

Add swap space

  • Create swap partition using fdisk
  • Create swap filesystem
sudo mkswap <device>
  • Activate swap
sudo swapon <device>
  • Modify /etc/fstab to allow swap to be activated at boot time

Change userid/groupid for an existing user/group

  • Change groupid in /etc/group
  • Run sudo grpconv to update /etc/gshadow
  • Change userid in /etc/passwd (and also the primary groupid for any changed groupids)
  • Run sudo pwconv to update /etc/shadow

Music Naming Strategy

Type Title TrackNum Artist Sort Artist Album Artist Sort Album Artist Album Sort Album Disc Genre Compilation
TIT2 TRCK TPE1 TSOP TPE2 TSO2 TALB TSOA TPOS TCON TCMP
Albums Title TrackNum Artist BLANK Directory1 BLANK / Number word Album Directory2 [Disc n] Disc Genre BLANK
Compilations Title TrackNum Artist BLANK Various Artists ZZZD Album Directory2 [Disc n] Disc Genre 1
Singles Title BLANK Artist BLANK Various Artists ZZZH Singles BLANK BLANK Genre 1
Soundtracks Title TrackNum Artist BLANK Various Artists ZZZL Album Directory2 [Disc n] Disc Soundtrack (24) 1
Spoken Title TrackNum Artist BLANK Directory1 ZZZP Album Directory2 [Disc n] Disc Genre BLANK
Fun Title BLANK Artist BLANK BLANK ZZZT Fun BLANK BLANK Comedy (57) 1
  • Albums: eyeD3 --to-v2.3 --set-text-frame="TSOP:" --set-text-frame="TPE2:$artist" --set-text-frame="TSO2:" --set-text-frame="TSOA:$album" --set-text-frame="TCMP:" $file
  • Compilations: eyeD3 --to-v2.3 --set-text-frame="TSOP:" --set-text-frame="TPE2:Various Artists" --set-text-frame="TSO2:ZZZD" --set-text-frame="TSOA:$album" --set-text-frame="TCMP:1" $file
  • Singles: eyeD3 --to-v2.3 --set-text-frame="TRCK:" --set-text-frame="TSOP:" --set-text-frame="TPE2:Various Artists" --set-text-frame="TSO2:ZZZH" --set-text-frame="TALB:Singles" --set-text-frame="TSOA:" --set-text-frame="TPOS:" --set-text-frame="TCMP:1" $file
  • Soundtracks: eyeD3 --to-v2.3 --set-text-frame="TSOP:" --set-text-frame="TPE2:Various Artists" --set-text-frame="TSO2:ZZZL" --set-text-frame="TSOA:$album" --set-text-frame="TCMP:1" $file

File Ownership

  • chown root:admin $file
  • chmod 664 $file
  • chown root:admin $dir
  • chmod 775 $dir

Measuring LAN performance

Host 1 (linux):

iperf -s -p 8123

Host 2 (mac):

~/bin/iperf -c host1 -p 8123

screen: Start a screen session with a title

 screen -S <title>