(that I can not remeber)
grep -Hir "some text" *
du -shc *
# including hidden files
du -shc .[!.]* *
grep --color=auto "some text" myFile.log
grep -lr "some text" *
find . \( -name "\.classpath" -o -name "\.project" \) -exec rm -rf '{}' \;
find . -maxdepth 5 -type d \( -name "target" -o -name ".settings" \) -exec rm -rf '{}' \;
sudo dpkg-reconfigure tzdata
netstat -antupl | grep 8080
lsof -i TCP:8080
# use a backslash as first character. e.g \ls
\ls
egrep -v "^#|^$" httpd.conf
rename 's/^unwanted//' *.jpg
http://www.akadia.com/services/ssh_test_certificate.html
#key
openssl genrsa -des3 -out server.key 1024
# csr
openssl req -new -key server.key -out server.csr
# remove password
cp server.key server.key.org
openssl rsa -in server.key.org -out server.key
# generate cert
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
vim ~/.bashrc
export HISTCONTROL=ignoredups:erasedups # no duplicate entries
export HISTSIZE=100000 # big big history
export HISTFILESIZE=100000 # big big history
shopt -s histappend # append to history, don't overwrite it
# Save and reload the history after each command finishes
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/[\1] /'
}
export PS1="\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \[\033[01;31m\]\$(parse_git_branch)\[\033[00m\]$\[\033[00m\] "
Somehow Ctrl+arrowleft / Ctrl+arrowright break after doing that. So the last two lines are for fixing that.
vim ~/.inputrc
# for arrow up down
"\e[A": history-search-backward
"\e[B": history-search-forward
# or instead pgup pgdn
#"\e[5~": history-search-backward
#"\e[6~": history-search-forward
# fix ctrl left/right
"\e[1;5C": forward-word # ctrl + right
"\e[1;5D": backward-word # ctrl + left
To reload ~/.inputrc
bind -f ~/.inputrc
# view mac address
ifconfig -a | grep HWaddr
# change mac address
ifconfig wlan0 down
ifconfig wlan0 hw ether 00:80:48:BA:d1:30
ifconfig wlan0 up
ifconfig wlan0 |grep HWaddr
nmap -v 192.168.0.*
dpkg -l | grep linux-image-.*-generic
sudo apt-get install --reinstall linux-image-3.X.Y-ZZ-generic
fallocate -l 4G /swapfile && \
chmod 600 /swapfile && \
mkswap /swapfile && \
swapon /swapfile && \
echo "/swapfile none swap sw 0 0" >> /etc/fstab
# Securely forward TCP connections on local port 1234 to remote2 port 4321
ssh -L 1234:http://remote2.example.com:4321 [email protected]
# Show which services are set to start on Red Hat based system at any runlevel.
chkconfig --list | grep :on
read mails in console (gmx pop3)
openssl s_client -ssl3 -starttls pop3 -crlf -connect pop.gmx.net:110
user myUserName
pass myPass
stat
list
top 1 0 # first mail, only header
top 1 10 # first mail, header + first 10 lines
retr 1
dele 1
quit
http://vim.wikia.com/wiki/Best_Vim_Tips
start selection
v
select complete line
V
delete until end of document
dG
go to next occurence of character in line
f
example:
'fx' goes to next 'x'
';' to go forward
',' to go backward
go to next occurence of word
*
example:
'*' and cursor is on the word 'foo', cursor will jump to next occurrence of 'foo'
go to next occurence of character in line
Substitute
:%s/foo/bar/g
Find each occurrence of 'foo' (in all lines), and replace it with 'bar'.
:s/foo/bar/g
Find each occurrence of 'foo' (in the current line only), and replace it with 'bar'.
:%s/foo/bar/gc
Change each 'foo' (case insensitive) to 'bar'; ask for confirmation.