Created
November 21, 2013 22:56
-
-
Save rrubiorr81/7591347 to your computer and use it in GitHub Desktop.
Adv 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
// | |
///math on the terminal... | |
//evaluating math expressions in the terminal... | |
expr 1 + 1 | |
//piping the content into bc.. | |
echo "1 + 3 * 12 - 3"| bc | |
bc | |
///pushing btw directories | |
//works like the cd but this one stores the new folder into a stack | |
pushd /var/some_data | |
popd | |
dirs //shows the content of the stack | |
///metacommands | |
man pwd | |
which bc | |
file afile.ext //gives details of this file | |
file `which vim` //the result of the which goes to file | |
basename //return the last part of the path | |
basename `which nano` | |
clear //same as (ctrl + l) | |
///file operations | |
gzip un_fichero.txt // | |
gzip -d un_fichero.txt | |
//when using > u overwrite the file like in | |
ls > out.txt //if u use >> , the content is going to be appended... | |
#0 stdin //standart input | |
#1 stdout //standart output | |
#2 stderr //standart err | |
//searching in the result of this output.. | |
ls | grep fichero | |
//when doing | |
ls askdjaskd 2> kk.txt //u tell the shell to store in kk.txt the error resulting error mesage (the 2 stands for error) | |
//this is telling the shell to put the errors (&2) in the standart out (&1), all finishing in the same place... | |
ls INvalid_dir ~ > dirs.txt 2>&1 //the short way to do this is | |
ls INvalid_dir ~ &> dirs.txt | |
//the shell wait for u to put some input (&0) | |
cat > testing.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment