This is just for myself. So ignore, or use as you please, but at your own risk. This list will grow as I figure out more shortcuts. Ktnxbai.
The script ran when logging in can be found in
~/.bash_profile, however the script ran when you open a new terminal is
~/.bashrc. You can do bash commands there, but you could also use node there (provided that it's installed).
#!/bin/sh
# comment
stuff
#!/usr/local/bin/node
require("jasmine-node");
Add and show stuff to paths and other variables (put this in a login script):
export NODE_PATH="~/node_modules/jasmine-node/lib:$NODE_PATH"
echo "$NODE_PATH"
To run a command from terminal without "locking it" as long as the app runs, add
& at the end. All output will still flow to this terminal (can become a little confusing).
gedit /etc/some.file
gedit /etc/some.file &
After doing so (or pressing ctrl+z to freeze a running app), to switch back to that task "thread":
fgYou can then (for instance)
ctrl+c to kill that thread or
ctrl+z to freeze the thread and return to the terminal.
To launch some file with the Ubuntu associated file based on extension
gnome-open /etc/some.file
To run a script or such, prefix it with
./, it must have execution permissions
// set execution permission
chmod +x bar
// run
./bar
Show all processes
ps -A
Search for specific process
ps -A | grep sshd
Kill a process
kill 1234
// kill++
kill -9 1234
Process tree (ascii)
pstree
Check for specific programs listening to incoming ports
sudo ss -lnp | grep sshd
SSH into somewhere (ok, duh)
ssh localhost
Start sshd
sudo /etc/init.d/ssh restart
SSH and SSHd configs
gedit /etc/ssh/sshd_config
gedit /etc/ssh/ssh_config
Get your ips
ifconfig | egrep "inet|Link"
Simple network speed monitor tool:
bwm-ng
Advanced monitoring tool (see which app is using network, requires root):
nethogs
Search files for string
// straightforward
grep -r -i needle ./path
// only list files+line
grep -r -i -n -l needle ./path
// recursive, case insensitive, line numbers, ignore css files
grep -r -i -n --exclude=*.css* logg .
// ignore files, ignore dirs, find dot
grep -r -n --exclude=*css* --exclude=*json* --exclude-dir="*framework*" navigator\\. .
// content of file
grep -R '^FWS' *
// just the matching part
grep -h -o -P -r 'abc.*?def"' *
Mounting windows share:
http://industriousone.com/blog/mounting-windows-shares-linuxOr on desktop, go to
file,
connect to server or
open location (the last one being
ctrl+L) to do it once but simpler.
To ping hostnames, append
.local behind their "Windows" hostnames (or
fix it properly ;)
Using
scp (
source, target must run
ssh-server)
//This is the Linux scp command syntax to send file or directory to a remote computer:
scp -r /path/filename login@ip:.
// This is the Linux scp command syntax to retrieve file or directory from a remote computer:
scp -r login@ip:/path/filename .
// copy all dirs from current pwd to target (targetdir must exist)
scp -r ./* targethost:~/targetdir
Using
rsync to copy two dirs while ignoring symlinks (impossible with
scp). Note that this is not secure, but you can read the
source to find out how to do that).
rsync -lav [user@host:]path/* [user@host:]path
Apache2 stuff
// vhost config path
/etc/apache2/sites-enabled/
// restart
sudo /etc/init.d/apache2 restart
// add alias (add also the <Directory> block). in a vhost config file:
Alias /alias /home/user/folder
Keys:
Open terminal:
ctrl+alt+tLock workstation:
ctrl+alt+lToggle hidden files in file manager:
ctrl+hToggle location bar input/crumb path in file manager:
ctrl+lGnome tweaker
gconf-editor
Ubuntu Tweaker
http://ubuntu-tweak.com/Check if 3d is working (
Not a benchmark..), part of
mesa-utils package.
glxgears
GTK perf test suite
gtkperf
If you have installers with a
.run extension, you need to set their permissions to be executable. In properties of the file, in permissions, tick the box. Then double click. Or from console:
chmod +x foo.sh
OpenAL package is
libopenal-devFix aptana 2 installation:
sudo apt-get install xulrunner-1.9.2 (very specific, I know :)
Clean up aptana 2 folder trash:
check hereLag after suspend fix:
http://www.nvnews.net/vbulletin/showthread.php?t=158091The equivalent to
netstat in windows
sudo netstat -ntupl
Installing
nodejs (do not use debian package, clone git instead!)
Make sure you replace the path in the last line to the proper path, where you checked out node to (try
pwd at that point).
Also note that the node repo is no longer Ryan's sub repo, but that of Joyent. Old tutorials list
/ry.
sudo apt-get install g++ curl libssl-dev apache2-utils
sudo apt-get install git-core
git clone https://github.com/joyent/node
cd node
./configure
make
sudo make install
export PATH="path-to-node-bin:$PATH"
Installing
npm on top of that (note, you need to be root, that's why
sudo is added to the
sh):
curl http://npmjs.org/install.sh | sudo sh
Jshint after npm:
sudo npm install jshint
Next
jasminenpm install jasmine-node
After which you can require it in node
var jasmine = require("jasmine-node");
If you ever get the error
configure: error: "no (requires X development libraries)", then this is the library you need to include (Which is also included in the
gtk+-3.0 package btw.):
sudo apt-get install xorg-dev
Reset sound after it becomes digitally wonky (happens a lot on my system, root problem seems to be some kind of system load..):
alsa force-reload
Mount ssh connection as local drive ("sftp") (
source). You need some kind of root for this. I'll use
sudo for this.
sudo cd /media
sudo mkdir sftpdir
sudo chown your-user-name /media/sftpdir
sudo adduser your-user-name fuse
sshfs user@example.com:/stuff /media/sftpdir
Read/write clipboard (hexdump for analyzing bytes)
xclip -o | hexdump -C
echo -n $'a\r\nb' | xclip -i -selection clip-board
Find correct drive and format SD card (or whatever)
df
Find the device that holds your SD card. It'll look something like
/dev/sdd1. The descriptions are of course quite important here ;) Once you have it, unmount and format the drive (since it's for a camera, I'm formatting it in fat32). You need root for this (or sudo).
sudo umount /dev/sdd1
sudo mkdosfs -F 32 -v /dev/sdd1
To "burn" an iso to usb (or to create a bootabla usb drive from an image). This one's pretty damn hard to find unless you know where to look...
usb-creator-gtk
usb-creator-kde
(There's actually a bug where you might end up with the message: "An uncaught exception was raised:Invalid version string 'GNU/Linux'" when trying to build a linux disk this way, in that case you need to add a flag. It will still throw the error, but the usb will actually work after it. Note that this option actually allows you to pick ANY drive, so be very careful and make sure you pick the usb drive!
source)
sudo usb-creator-gtk --allow-system-internal
Rename a drive:
sudo mlabel -i /dev/sdc1 ::<new_label>
Combine multiple pdfs into one... (yeah, needed that once).
Sourcesudo apt-get install gs pdftk
gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=combinedpdf.pdf -dBATCH 1.pdf 2.pdf 3.pdf
To get rid of certain default entries in the notifier (the envelope), here's what you do (reboot afterwards). For other entries, you'll have to go to
/usr/share/indicators/messages/applications and remove (
sudo rm ...) entries manually.
// broadcast accounts (facebook, twitter, etc)
sudo apt-get remove evolution
// default instant messenger (yahoo, msn, etc)
sudo apt-get remove empathy
Codec stuff. Actually just from
here.
sudo apt-get install libxine1-ffmpeg gxine mencoder mpeg2dec vorbis-tools id3v2 mpg321 mpg123 libflac++6 ffmpeg libmp4v2-0 totem-mozilla icedax tagtool easytag id3tool lame nautilus-script-audio-convert libmad0 libjpeg-progs libquicktime1 flac faac faad sox ffmpeg2theora libmpeg2-4 uudeview flac libmpeg3-1 mpeg3-utils mpegdemux liba52-dev
sudo apt-get install gstreamer0.10-ffmpeg gstreamer0.10-fluendo-mp3 gstreamer0.10-gnonlin gstreamer0.10-sdl gstreamer0.10-plugins-bad-multiverse gstreamer0.10-schroedinger gstreamer0.10-plugins-ugly-multiverse totem-gstreamer
Other stuff to have: dropbox, pidgin, deluge, keepassx, chrome, (firefox), opera, ubuntu-tweak (see below), compiz settings, htop, gkrellm, mint-menu, flash, xchat.
sudo add-apt-repository ppa:ubuntu-tweak-testing/ppa
sudo apt-get update
sudo apt-get install ubuntu-tweak
sudo apt-get install compizconfig-settings-manager
Enable case-insensitive file/directory tabbing. I needed to open a new terminal for this setting to take effect. Afterwards you can do
cd de and tab to jump to
Desktop.
sudo nano /etc/inputrc // can also be ~/.inputrc ...
// now add the next line at the end of the file
set completion-ignore-case on
Enabling
.htaccess in Apache2 (for Ubuntu). Simply edit
/etc/apache2/sites.enabled/default and change
Override None to
Override All. (
Source)
Change and flush DNS settings:
sudo vi /etc/resolv.conf
sudo /etc/init.d/dns-clean start
Set up vpn... First install
sudo apt-get install network-manager-openvpn, then go to network icon in systray. Go to VPN connections. In VPN tab, import magic settings (sorry, I received these from other people). Close the popup. Reconnect your current connection (otherwise the vpn option wont show). In the systray, open the network icon, go to vpn and there should be your new VPN connection. To use the VPN only for specific domains, go to the network panel, vpn tab, ip4 settings, click routes button, and select "Use this connection only for resources on its network". Now you can keep skyping and googling while still able to reach resources on your vpn :)
Screen sharing:
http://www.mikogo.de/download/linux-download/Install a BNC (ZNC):
https://gist.github.com/1409670Compare two binary files with
vbindiff.
Make OSD (system) notifications use active screen:
gconftool-2 -s -t string /apps/notify-osd/multihead_mode focus-follow
Check audio channels (sends sound to each speaker consecutively) (
source):
speaker-test -Dplug:surround51 -c6 -l1 -twav
Fix flash player inverted colors on youtube et.al. (
source, worked for me)
sudo mkdir /etc/adobe
echo -e "EnableLinuxHWVideoDecode=1\nOverrideGPUValidation=true" | sudo tee /etc/adobe/mms.cfg > /dev/null
Fix Deluge (bittorrent client) from crashing your router, especially if it only affects your cable but not your wireless: Disable
dht in settings. This probably causes your router to crash your NAT table.
Update DNS to be faster. In
/etc/nsswitch.conf move the
dns entry forward:
hosts: files dns wins mdns4_minimal [NOTFOUND=return] mdns4
Fix a very broken package that blocks
apt-get. In my case, I tried reverting to an older version of
gnome-screenshot, but that kind of backfired because it broke
apt-get due to a cyclic dependency. So I could not update the system and could not use the update system to fix that. In fact, it turned out
apt-get could not be used to fix the problem (even though it caused it) and I had to fall back to
dpkg. This was the only way for me to remove the bad package (immediately added after that). Ps. the
source lists an even more extreme method if this doesn't work for ya...
dpkg --remove --force-all gnome-screenshot
Python webserver onliner:
python -c "import SimpleHTTPServer;SimpleHTTPServer.test()"
Enable line-in as sound output (
source):
pactl load-module module-loopback
Convert movie to animated gif, using ffmpeg and gifsicle:
Note: the
-r 30 is the converted frame rate of the movie, gif is max 30 fps and
--delay=1 should be set to an integer such that
delay*fps=30.
sudo apt-get install ffmpeg
sudo apt-get install gifsicle
ffmpeg -i input.ogv -pix_fmt rgb24 -r 30 -f gif - | gifsicle --optimize=3 --delay=1 > output.gif