-
-
Save menuka94/f8cabc16e586493ada830990c0249538 to your computer and use it in GitHub Desktop.
Linux Commands
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
# Find the process IDs | |
ps awx | grep nautilus | |
# Then kill it | |
sudo kill -TERM <id> |
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
#locate | |
locate -i *red*house**city* | |
# top 30 largest files | |
du -sb * | sort -nr | head -30 | |
# directory count | |
ls -l | grep ^d | wc -l | |
# directory count (recursively) | |
ls -lR | grep ^d | wc -l | |
# directory size | |
du -ch | grep total | |
# empty trash | |
rm -rf ~/.local/share/Trash/* | |
# check free disk space | |
df -h | |
# Search the specific word in directory and show filenames | |
grep -H -R 'eval(' . | cut -d: -f1 | |
# Find suspicious PHP files | |
find . -type f -name "*.php" -exec grep --with-filename "eval(\|exec(\|base64_decode(" {} \; | |
./virus.php: eval(base64_decode($_GET['a'])); | |
# Find files | |
find . -print | grep -i '*.php' | |
# Search for files containing a word in directory | |
grep -r word * | |
# Seach for a file containing a word excluding a directory | |
grep -r query --exclude-dir=vendor | |
# Kill process running on port 9001 | |
sudo kill `sudo lsof -t -i:9001` | |
sudo kill -9 $(sudo lsof -t -i:9001) | |
fuser -k 9001/tcp |
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
# will work for PDF of any number of pages | |
pdftk in.pdf cat end-1 output out.pdf |
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
nohup java -jar /web/server.jar & | |
# The & symbol, switches the program to run in the background. | |
# The nohup utility makes the command passed as an argument run in the background even after you log out. |
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
# Show git branch name | |
force_color_prompt=yes | |
color_prompt=yes | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
if [ "$color_prompt" = yes ]; then | |
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;31m\]$(parse_git_branch)\[\033[00m\]\$ ' | |
else | |
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(parse_git_branch)\$ ' | |
fi | |
unset color_prompt force_color_prompt |
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
# Change Default Text Editor | |
sudo update-alternatives --config editor |
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
# locate java installation dir | |
$ readlink -f $(which java) | |
## using symoblic links | |
# step 1 | |
$ whereis java | |
java: /usr/bin/java /etc/java /usr/share/java | |
# step 2 | |
$ ls -l /usr/bin/java | |
lrwxrwxrwx 1 root root 22 2009-01-15 18:34 /usr/bin/java -> /etc/alternatives/java | |
# step 3 | |
$ ls -l /etc/alternatives/java | |
lrwxrwxrwx 1 root root 31 2009-01-15 18:34 /etc/alternatives/java -> /usr/local/jre1.6.0_07/bin/java |
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
# install n | |
sudo npm install -g n | |
# then | |
sudo n latest | |
# or | |
sudo n current | |
# or | |
sudo n lts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment