Created
February 12, 2013 16:15
-
-
Save compleatang/4771007 to your computer and use it in GitHub Desktop.
Simple reference file for commands that I need every once in a while but have a difficult time remembering....
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ZSH | |
sudo add-apt-repository ppa:XXXXXXXX - to add repository | |
se /etc/apt/sources.list - where to add repositories manually | |
rm /var/lib/apt/lists/XXXXX - another place where repositories are kept | |
chown -R www-data /usr/share/wordpress - to change the owner of a file, recursively | |
df -h - to check the size of the disk and % used! | |
ps aux - to see all of the running processes! | |
grep -v XXXXX - sort a file but skip any line that has XXXXX on it | |
dig +short - to see the IP of a web site | |
apt-get install <package-name>=<version> - to install a specific version of a package | |
cd - -> to return to previous working directory; use recursively to flip | |
dpkg -i - install a debian package | |
dpkg -l | grep XXXXX - search all debian packages installed to see if XXXXX is there | |
dpkg -L XXXXX - find the locations of all files associated with XXXXX package | |
dpkg --get-selections - list all installed debian packages | |
rm ~/.pkgs && dpkg --get-selections > ~/.pkgs - pipe the list into a specific file | |
find / -name themes -type d - find format / is for location "themes" is search d is for directory (f=files) | |
chmod - 4 = read 2 = write 1 = xecute | |
7z a -v5m -mx0 ubuntu.7z ubuntu.iso - split .iso into 5M pieces without compression (-mx0 switch) | |
7z x ubuntu.7z.001 - extract the split file | |
# VIM | |
## Editing | |
:335,1045d - delete lines 335-1045 | |
:%s/<word>//gn - Count the number of occurences of a word in a file with | |
"2p - pastes the second to last thing yanked | |
]m - jump to the end of the current method/function - [m beginning of current | |
[M - jump to the beginning of the next method/function - ]M end of next | |
"+gP - paste from clipboard for outside in pastes don't have to be in insert mode | |
:%s/perform/execute/g - to SEARCH & REPLACE perform with execute to the bottom of the page | |
J - join line below with current one | |
Ctl-x - decrements the number under the cursor, Ctl-a to increment | |
cc - replace an entire line | |
cw - replace to the end of the word | |
xp - transpose two letters | |
C - chop the end of a line at the cursor and go into insert mode | |
dL - delete to the end of the currently visible page | |
gg"+yG - copy entire file onto the X-term clipboard | |
## Moving, Selecting & Navigating | |
V - visual line mode (different than visual mode) | |
f - find up to a character (usually use with visual mode) | |
t - find one less than a character (use with visual mode) | |
g+ - Go forward to a later edit (like redo but switching edit branches of the document after a fork) | |
g- - Opposite of the above | |
:earlier 20s - returns to document to its exact status 20s before | |
:vsplit filename - splits the window vertically and opens the file in the left-hand pane | |
Ctl-f - page forward | |
Ctl-b - page backwards | |
:ls - list all the current open buffers | |
W - jump by words (excludes punctuation) | |
E - jump to end of words (excludes punctuation) | |
B - jump backwards by words (excludes punctuation) | |
^ - jump to first non-blank character of line | |
:sp - Split screen (horizontal), :vsp - split screen vertical | |
Ctl-w H - switches a horizontal split to a vertical | |
Ctl-w K - switches a vertical split to a horizontal | |
Ctl-w | - maximizes current vertical split | |
Ctl-w _ - maximizes current horizontal split | |
Ctl-w = - equalizes split | |
:only - closes the other splits and only keeps open the current split | |
# GIT | |
git reset --hard HEAD -- when you just get fed up and need to go back to the last real commit | |
git rm --cached readme.txt -- to remove from repository but not from harddrive | |
git fetch && git rebase -i origin/master -- to fetch upstream changes and move along the current branch appropriately | |
git push origin :branch -- delete remote <branch> | |
git rm --cached <file> -- remove from repository if not committed but leave on fs | |
git update-index --no-assume-unchanged <file> -- To remove the file you're interested in from version control | |
# RVM | |
rvm --create --rvmrc 1.8.7@project - create the gemset, and the .rvmrc file for the project all in one command! | |
# compiling from source | |
cd /tmp | |
wget LINK | |
tar xzvf FILE | |
cd DIR | |
./configure | |
make | |
make install | |
# migrating a machine | |
(remember to also copy /etc/apt/sources.list from old machine) | |
dpkg --get-selections | grep -v deinstall > dpkg-get.txt - OLD MACHINE | |
dpkg --clear-selections - NEW machine, this will CLEAR it, only do if 100% cloning | |
cat dpkg-get.txt | dpkg --set-selections | |
apt-get dselect-upgrade | |
# LAMPP Stack | |
~/sites/lampp/lampp start - Starts XAMPP. | |
~/sites/lampp/lampp stop - Stops XAMPP. | |
~/sites/lampp/lampp restart - Stops and Stacktarts XAMPP. | |
~/sites/lampp/lampp startapache - Starts only the Apache. | |
~/sites/lampp/lampp startssl - Starts the Apache SSL support. This command activates the SSL support permanently. | |
~/sites/lampp/lampp startmysql - Starts only the MySQL database. | |
~/sites/lampp/lampp startftp - Starts the ProFTPD server (user "nobody", password "lampp"). | |
~/sites/lampp/lampp stopapache - Stops the Apache. | |
~/sites/lampp/lampp stopssl - Stops the Apache SSL support. This compiling deactivates the SSL support permanently. | |
~/sites/lampp/lampp stopmysql - Stops the MySQL database. | |
~/sites/lampp/lampp stopftp - Stops the ProFTPD server. This command deactivates the ProFTPD permanently. | |
~/sites/lampp/lampp security - Starts a small security check program. | |
create database NAME; | |
grant all privileges on gallery.* to 'ryan'@'localhost' identified by "GanD1do"; - where ryan is user, Gan is pwd and gallery is dB | |
flush privileges; - to flush the privileges! | |
exit; | |
mysqldump -u username -p databasename > filename.sql to export | |
mysql -u username -p databasename < filename.sql to import | |
# Brothers Printer | |
lsusb | |
sudo chmod a+w /dev/bus/usb/002/008 | |
# Insync Uninstall | |
sudo rm -rf /usr/lib/insync | |
sudo rm /usr/bin/insync /usr/bin/insync-set /usr/bin/insync-get | |
rm ~/.local/share/nautilus-python/extensions/insync_plugin.py | |
#Frontline Setup | |
sudo ln -sf /dev/ttyACM0 /dev/ttyS0 | |
sudo wvdialconf | |
dmesg | tail |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment