From 4a162a00e1357ca293497add5da35ffd8c562167 Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Sun, 19 Nov 2017 21:22:13 -0500 Subject: [PATCH] Add a variety of useful commands to commands.md --- help/commands.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/help/commands.md b/help/commands.md index 9b244662..c3c76891 100644 --- a/help/commands.md +++ b/help/commands.md @@ -14,11 +14,19 @@ Note that "renaming" files is the same as moving them from one location to anoth - Remove (delete) a directory: `rm -r ` - Make a new file: `touch ` - Make a new directory: `mkdir ` -- List all the files in a directory: `ls` +- List all the files in a directory: `ls` **OR** `find` - List all the directories in a directory: `ls -d */` - List all the files in a directory, including dotfiles: `ls -A` - List all the files in dirname: `ls ` - Only list png and jpg files: `ls *.{png,jpg}` +- Print the file type based on header information: `file ` +- Show all running processes as a tree: `pstree` +- Print the number of new lines: `wc -l ` +- Print the maximum line length: `wc -L ` +- Print the word count: `wc -w ` +- Show the size of the current directory, including subdirectories: `du -h` +- Show the size of the current directory and its files: `du -ha` +- Get more information about any command: `man ` ## Switching Directories @@ -42,6 +50,7 @@ Note that for all of the above, `cd` is not required. - Change the permissions of a directory to all users: `chmod -R a+rwX dir/` - Give permissions to the user `hello` and the group `world`: `chown -R hello:world dir/` - Given text input, return only unique lines (aka no duplicates): `cat | uniq` +- Search all files in a directory (and all subdirectories) for a given string: `grep -inr ` **OR** `g ` ### System Commands @@ -56,6 +65,7 @@ These programs are installed on top of the base system. - List the entire contents of a directory: `tree` - List all the directories in a directory, up to 2 levels deep: `tree -d -L 2` - Beautify any JSON output: ` | jq '.'` +- Easily search for a file in a directory and its subdirectories: `fzf` ### Inox @@ -111,6 +121,11 @@ Note that if you ever get 404s with `pacman` or `pacaur`, you need to update you - Remove all cached versions of packages except the most recent one: `paccache -rk1` - Remove all cached versions of uninstalled packages: `paccache -ruk0` +### Working with Online Resources + +- Download anything online: `wget ` +- View the response header and contents of any webpage: `http ` + ## Custom Commands - Easily switch to a 4k resolution with DPI scaling: `4k`