Difference between revisions of "Ubuntu console notes"
(→Web cams) |
(→Web cams) |
||
Line 259: | Line 259: | ||
</pre> | </pre> | ||
<pre> | <pre> | ||
+ | $ streamer -s 1184x656 -c /dev/video0 -b 32 -o /tmp/pic.jpeg | ||
$ mplayer tv:// -tv device=/dev/video0 | $ mplayer tv:// -tv device=/dev/video0 | ||
− | mplayer tv:// -tv device=/dev/video0:width=1184:height=656 | + | $ mplayer tv:// -tv device=/dev/video0:width=1184:height=656 |
</pre> | </pre> | ||
Revision as of 10:32, 25 July 2011
Contents
- 1 GENERAL
- 2 FILES and FOLDERS
- 3 USERS
- 4 HARDWARE
- 5 HDD
- 6 PROCESSES
- 7 LOGS
- 8 Time & NTP
- 9 CONFIGURE SOMETHING
- 10 NETWORKING
- 11 FTP
- 12 SSH
- 13 rsync
- 14 Samba
- 15 SCREEN
- 16 SERVICES / DAEMON MANAGEMENT
- 17 lm-sensors
- 18 HDDTEMP
- 19 IPTABLES
- 20 Buletooth
- 21 GNOME
- 22 POWER
- 23 SERVICES
- 24 MOBLOCK
- 25 Web cams
- 26 SVN
- 27 VNC
- 28 Fonts
- 29 Security
- 30 MySQL
- 31 Media conversion
- 32 CRC
GENERAL
notes: to put " " in a command, it must be escaped, "\ " to do 2 commands, seperate with " && "
list something: ls
FILES and FOLDERS
these are easy: cd pwd(Print Working Directory) mkdir cp (copy), mv (move / rename), rm (remove) (remove directory with subitems: "rm -rf") ls -lah (list symbolic links) du (measure file/folder size) df (free space) ("df ." shows partition with current dir)
copy new files: rsync -rtP /media/a/a /media/b/ (recursive, preserve time stamps, partial and progress)
permissions: chmod - change rights chown - change ownership chgrp - change group
root: "sudo -i"
USERS
list all users: cat /etc/passwd | cut -d ":" -f1
change password: passwd
make a user: sudo useradd <username> sudo useradd -d /home/<username> -m <username> sudo passwd <username>
groups: sudo groupadd subversion //sudo useradd -G subversion haku sudo usermod -a -G subversion haku
show groups: $ groups
HARDWARE
list drives: sudo lshw -short -C disk
list devices: lspci
free mem: free
HDD
mount: "sudo mount /dev/sda1 /mnt" (sda1 may be a usb / sata / scsi) (make perminant by using "sudo nano /etc/fstab" umount: "sudo umount /mnt" or "sudo umount /dev/hda1" (can point at either device or mount point) eject: "sudo eject /dev/hdc" (note the lack of a number - eject the volume, not the partition) ( $ ls /dev/sd* )
new: find: sudo lshw -C disk partition: sudo fdisk /dev/sdc format: sudo mke2fs -j /dev/sdc1
PROCESSES
list active processes: ps aux
LOGS
read with less
Time & NTP
ntpdate rdate nano /etc/ntp.conf
CONFIGURE SOMETHING
dpkg-reconfigure xserver-xorg
NETWORKING
list network connections: sudo ifconfig
status: netstat netstat -ant (t = tcp) netstat -anu (u = udp)
list open ports again process id: sudo netstat -lpn
edit net config: sudo nano /etc/network/interfaces
dns servers: sudo nano /etc/resolv.conf
restarting networking: sudo /etc/init.d/networking restart
wifi.config: iwconfig
wifi.scan for wifi access points: iwlist scan
wifi config code to go in /etc/network/interfaces note: AuthMode can be "WEPAUTO", "OPEN", "SHARED", "WPAPSK", "WPA2PSK", "WPANONE" note: EncrypType can be "NONE", "WEP", "TKIP", "AES" auto ra0 iface ra0 inet dhcp pre-up iwpriv ra0 set AuthMode=WPAPSK pre-up iwpriv ra0 set EncrypType=TKIP pre-up iwconfig ra0 essid my_essid pre-up iwpriv ra0 set WPAPSK="my_pass_key"
FTP
start ftp server: sudo /etc/init.d/proftpd [start/stop/restart]
check conf: sudo proftpd -td5
SSH
SSHd config file: sudo nano /etc/ssh/sshd_config
SSHd restart: sudo /etc/init.d/ssh restart
rsync
commands:
sudo nano /etc/default/rsync (change "RSYNC_ENABLE=true") sudo nano /etc/rsyncd.conf sudo nano /etc/rsyncd.secrets sudo /etc/init.d/rsync restart
Samba
mount:
sudo mount -t cifs //192.168.0.42/qnap0 -o username=admin,password=password,iocharset=utf8 /media/pc5_qnap0/
SCREEN
general crtl+a, " (window list) ctrl+a, # (replace # with a number to switch to screen #) ctrl+a, c (create a screen) screen -ls (list detatched windows) screen -r [screen name] (re-attach a screen)
SERVICES / DAEMON MANAGEMENT
install manager: # sudo aptitude install sysvconfig
access manager: # sudo sysvconfig
lm-sensors
general sensors nano /etc/sensors.conf man sensors.conf (press q to exit)
HDDTEMP
sudo hddtemp /dev/hd
IPTABLES
show tables sudo iptables -L
save file /etc/iptables.up.rules
write / restore iptables-save / iptables-restore
Buletooth
send file:
$ gnome-obex-send
GNOME
config: $ gconf-editor
change window manager $ metacity --replace
POWER
suspend: $ sudo s2ram [--force] hibernate: $ sudo s2disk
SERVICES
configure startup services (may need putty): rcconf
MOBLOCK
general: sudo moblock-control start sudo moblock-control stop sudo moblock-control restart sudo moblock-control reload sudo moblock-control update sudo moblock-control status sudo moblock-control test
logs: tail -f /var/log/moblock.log
config file: /etc/moblock/moblock.conf
To whitelist IPs, edit the following part: # Do a "moblock-control restart" when you have changed these settings. WHITE_IP_IN="" WHITE_IP_OUT="" WHITE_IP_FORWARD=""
Insert e.g. "192.168.178.1" to whitelist a single IP, or e.g. "192.168.178.0/24" to whitelist an IP range (192.168.178.0 - 192.168.178.255) or e.g. "192.168.0.0/16" to whitelist a bigger IP range (192.168.0.0 - 192.168.255.255) Separate IP addresses with a whitespace.
Web cams
$ vgrabbj -d /dev/video0 -f cap000.jpg -i vga $ gqcam -v /dev/video0 -d cap000jpg
$ streamer -s 1184x656 -c /dev/video0 -b 32 -o /tmp/pic.jpeg $ mplayer tv:// -tv device=/dev/video0 $ mplayer tv:// -tv device=/dev/video0:width=1184:height=656
SVN
create new project:
$ sudo mkdir myproject $ sudo chown -R www-data:subversion myproject $ sudo chmod -R g+rws myproject $ sudo svnadmin create /home/svn/myproject $ sudo chmod -R g+rws myproject
user management: add first user:
$ sudo htpasswd -c /etc/subversion/passwd user_name
and more users / change passwd:
$ sudo htpasswd /etc/subversion/passwd second_user_name
VNC
$ vncviewer -bgr233 -encodings "tight copyrect" localhost:15901
Fonts
Put fonts in
/usr/share/fonts
Update font cache with:
sudo fc-cache -f -v
Security
- Change default home dir permissions to 700
sudo vi /etc/login.defs UMASK 0077
MySQL
Reset root password:
# dpkg-reconfigure mysql-server-5.1
Media conversion
aac to wav
$ mplayer -ao pcm a.aac -ao pcm:file="a.wav"
wav to mp3, mono, 192
lame -h a.wav a.mp3 lame -h -m m a.wav a.mp3 lame -h -b 192 a.wav a.mp3
fixing and info
mpg123 --rate 44100 --stereo --resync a.mp3 vbrfix a.mp3 exiftool a.mp3
extract audio from video
ffmpeg -i inputfile.flv -acodec copy output.mp3
GUI tool: soundconverter
CRC
Write and check:
$ find . -type f -print0 | xargs -0 md5sum > md5.txt $ md5sum -c md5.txt