mirror of
https://github.com/autistic-symposium/shell-whiz-toolkit.git
synced 2025-06-01 04:56:23 -04:00
more bash examples
This commit is contained in:
parent
68e3f7d899
commit
4b0a965e4a
9 changed files with 199 additions and 0 deletions
53
shell_scripts/lessons/TRICKS.md
Normal file
53
shell_scripts/lessons/TRICKS.md
Normal file
|
@ -0,0 +1,53 @@
|
|||
Wild Cards
|
||||
----------
|
||||
|
||||
Use *, ? (for one char), and [abc] for a series of options. Example:
|
||||
|
||||
$ ls [abc]*
|
||||
|
||||
|
||||
More commands on one line
|
||||
-------------------------
|
||||
|
||||
Use ;
|
||||
$ date;who
|
||||
|
||||
|
||||
Redirection of Standard output/input
|
||||
-----------------------------------
|
||||
|
||||
>, >>, <
|
||||
|
||||
Examples:
|
||||
|
||||
$ sort < filename > sorted_names
|
||||
|
||||
|
||||
Pipes
|
||||
-----
|
||||
A pipe is nothing but a temporary storage place where the output of one command is stored and then passed as the input for second command.
|
||||
|
||||
|
||||
Processes and PID
|
||||
-----------------
|
||||
An instance of running command is called process and the number printed by shell is called process-id (PID), this PID can be use to refer specific running process.
|
||||
|
||||
ps - show current running
|
||||
kill {PID} - kill process
|
||||
kill 0 - stop all processes except shell
|
||||
& - background process
|
||||
ps aux - display the owner of the processes along with the processes
|
||||
ps -ag - get information of all running processes
|
||||
ps ax | grep processes-you-want-to-see
|
||||
top - see currently running processes and other information like memory and CPU
|
||||
pstree - display a tree of processes
|
||||
|
||||
|
||||
|
||||
Useful Cmds:
|
||||
------------
|
||||
|
||||
List size of folders
|
||||
$ du -sh *
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue