.Rmd |
opts_chunk$set(cache.exta = 1) |
refresh cache |
NA |
bash |
tlmgr install <tex-pkg> |
install tex pkg |
NA |
rstudio project.Rproj |
open rstudio project |
NA |
mimeopen path/to/png.png |
open png |
NA |
evince path/to/pdf.pdf |
open pdf |
NA |
touch file.txt |
creates an empty text file |
NA |
* or ? |
* for many wildcard; ?? for 2-letter wildcard |
NA |
wc |
counts lines, words, characters in a file |
NA |
cat |
will print a file; or one file after another if given multiple files |
NA |
less |
shows a screenful and stops; go one screen forward with spacebar and back with b, q to exit |
NA |
sort |
sorts alphabetically; -n to sort numerically |
NA |
> |
sends to; i.e., can print to a file. differs from >> in that overwrites |
NA |
head/tail |
prints start/tail of file |
NA |
echo |
the echo command prints text |
NA |
>> |
appends; rather than overwrites as > does |
NA |
| |
pipe sends left of | to command on right |
NA |
cut |
removes sections of each line in a file; cut expects lines to be tab separator. -d option to specify delimiter -f to select a field (column) |
NA |
uniq |
filters adjacent matching lines in a file; use -c for count |
NA |
for thing in list_of_things
do
operation_using $thing # Indentation within the loop is not required, but aids legibility
done |
for loop; can be written line by line in console |
NA |
replace a string in all files from -i recursively |
`find . -type f -exec sed -i 's/oldtext/newtext/g' {} +` |
NA |
`dpkg -l {package_name}` |
To check whether a package is installed or not |
NA |
cal or ncal |
print month horizontally or vertically |
NA |
rename |
rename from to (install rename from apt) |
NA |
o count the number of lines: -l wc -l myfile.sh. To count the number of words: -w wc -w myfile.sh |
NA |
NA |
top |
see which processes are using the most resources |
https://superuser.com/questions/157783/how-to-check-which-applications-are-using-the-most-resources-on-a-server-via-com/157788 |
git |
git rm -r --cached . |
to ignore all files in .gitignore |
https://stackoverflow.com/questions/45400361/why-is-gitignore-not-ignoring-my-files |
R |
Sys.getenv |
For using environment variabes, usethis::edit_r_environ to modify environment variables |
NA |
sprintf |
thing <- "dog"
colour <- "red"
other_thing <- "cat"
sprintf("Here is a sentence about a %s %s chasing a %s",
colour,
thing,
other_thing) |
NA |
rstudio |
vignette("rd") |
roxygen syntax |
NA |
testthat::test_file("path") |
run tests in explicit file |
NA |
yaml |
output: tufte::tufte_html: |
from tufte:: |
NA |