Last active
August 29, 2015 14:26
-
-
Save rkennesson/93e20ae946f840128526 to your computer and use it in GitHub Desktop.
Bash Snippets
This file contains hidden or 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
#bash command line snippets | |
#more snippets http://www.commandlinefu.com/commands/browse |
This file contains hidden or 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
http://teohm.com/blog/2012/01/04/shortcuts-to-move-faster-in-bash-command-line/ |
This file contains hidden or 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
#Anonymous Read-only git access | |
git clone https://github.com/{user_name}/{project_name}.git | |
#SSH URL - must have ssh key setup | |
git clone [email protected]:{user_name}/{project_name}.git |
This file contains hidden or 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
#download and send to std out | |
#http://unix.stackexchange.com/questions/188000/github-gist-snippet-management | |
---- | |
#!/bin/sh | |
# gist-dl.sh: download a Github gist from a specified link to either a | |
# standard output (when no second argument passed) or to a | |
# specified file (with second argument passed). The first | |
# argument is a gist URL and is obligatory | |
if [ "$1"a = a ] | |
then | |
echo No gist URL passed. Bye | |
exit 1 | |
fi | |
if [ "$2"a = a ] | |
then | |
wget -q -O - "$1"/raw | |
else | |
wget -q -O "$2" "$1"/raw | |
fi | |
---- | |
usage: | |
# display to terminal | |
./gist-dl.sh https://gist.github.com/kylejohnson/6c6c0ca2d300ffce4bea | |
# save to file | |
./gist-dl.sh https://gist.github.com/kylejohnson/6c6c0ca2d300ffce4bea >> file_name.extension | |
######################################## | |
curl -L https://gist.github.com/westonruter/ea038141e46e017d280b/download > test.zip | |
unzip test.zip | |
#This snippet didn't work but got me on the right track. I might be able to figure out a better way to do this. | |
# | |
#http://www.commandlinefu.com/commands/view/13647/download-all-files-from-a-gist-without-git | |
# | |
#curl -L https://gist.github.com/westonruter/ea038141e46e017d280b/download | tar -xvz --strip-components=1 |
This file contains hidden or 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
ls | grep search_term |
This file contains hidden or 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
man 3 printf #display section 3 | |
man -a printf #display all sections | |
man -k '^printf' | |
#### | |
The table below shows the section numbers of the manual followed by the | |
types of pages they contain. | |
1 Executable programs or shell commands | |
2 System calls (functions provided by the kernel) | |
3 Library calls (functions within program libraries) | |
4 Special files (usually found in /dev) | |
5 File formats and conventions eg /etc/passwd | |
6 Games | |
7 Miscellaneous (including macro packages and conven‐ | |
tions), e.g. man(7), groff(7) | |
8 System administration commands (usually only for root) | |
9 Kernel routines [Non standard] |
This file contains hidden or 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
https://hostpresto.com/community/tutorials/how-to-use-screen-on-linux/ |
This file contains hidden or 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 | |
# | |
# dtrx - do the right extraction | |
# git - version control | |
# ssh - secure shell | |
apt-get install -y dtrx git ssh | |
# create .vimrc and disable vi compatibility mode | |
echo "set nocp" >> .vimrc |
This file contains hidden or 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
#http://unix.stackexchange.com/questions/140522/why-do-some-commands-not-read-from-their-standard-input | |
strace cat foo 2| grep foo | |
# execve("/bin/cat", ["cat", "foo"], [/* 44 vars */]) = 0 | |
# open("foo", O_RDONLY) | |
strace ls foo 2| grep foo | |
# execve("/bin/ls", ["ls", "foo"], [/* 44 vars */]) = 0 | |
# stat("foo", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0 | |
# lstat("foo", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0 | |
# write(1, "foo\n", 4foo |
This file contains hidden or 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
#http://askubuntu.com/questions/103623/download-files-from-a-list?answertab=oldest#tab-top | |
# download a list of files | |
wget -i text_file | |
# using cat | |
cat links.txt | wget -i | |
# parallel download uses cpu cores | |
cat urlfile | parallel --gnu "wget {}" | |
# use a input file to download files without typing the host name | |
# ie a file of '/folder/file' the '{}' in the command will be replace with the text in the file | |
cat urlfile | parallel --gnu "wget example1.com{}" | |
cat urlfile | parallel --gnu "wget example2.com{}" | |
#http://www.inmotionhosting.com/support/website/wordpress/easily-manage-wordpress-with-wp-cli | |
# to solve SSL certificate issues | |
wget --no-check-certificate https://github.com/wp-cli/wp-cli/raw/master/utils/wp-completion.bash |
This file contains hidden or 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
http://www.inmotionhosting.com/support/website/wordpress/easily-manage-wordpress-with-wp-cli | |
http://wp-cli.org/ |
This file contains hidden or 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
#http://askubuntu.com/questions/103623/download-files-from-a-list?answertab=oldest#tab-top | |
#download list of files | |
xargs -i wget -bqc 'http://{}' < download.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment