srdusr
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--linux/linux-commands.md21
1 files changed, 17 insertions, 4 deletions
diff --git a/linux/linux-commands.md b/linux/linux-commands.md
index 52695f1..39caeae 100644
--- a/linux/linux-commands.md
+++ b/linux/linux-commands.md
@@ -18,14 +18,27 @@
NOTE: `.` can also be used but is limited
`$ cp -r $(pwd)/path-to/file ~/new/path/`
`$ mv -r ~/another/directory/file .`
-
- - -
#### Copying/Pasting Text
-- Copy text/output into a file (useful if in putty/non graphical terminal emulator)
- `$ <command> 2>&1 | tee output-file`
+- Copy text/output of a command into a file (useful if in putty/non graphical terminal emulator)
+ `$ <command> 2>&1 | tee -a output.txt`
or
- `$ echo "text" 2>&1 | tee output-file` # print text without executing a command
+ `$ echo "text" 2>&1 | tee -a output.txt` # print text without executing a command
+- - -
+
+#### Recall the Previous Command
+- Use `!!` to express the last command
+ For example if a command needs root permissions:
+ ```bash
+ $ touch /opt/file.txt
+ touch: cannot touch '/opt/file.txt': Permission denied
+ $ sudo !!
+ sudo touch /opt/file.txt
+ [sudo] password for user:
+ $ ls -l /opt/myFile.txt
+ -rw-r--r-- 1 root root 0 Dec 21 16:20 /opt/file.txt
+ ```
- - -
#### Getting information about a window