From f8f812f8ad001a58afa9dbb46816ee71de8b3ae6 Mon Sep 17 00:00:00 2001 From: "Lakshmipathi.G" Date: Mon, 15 Feb 2016 01:33:59 +0530 Subject: [PATCH 01/10] nano editor for beginners --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 3283210..e4029af 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,8 @@ Notes: - Learn to use `apt-get`, `yum`, `dnf` or `pacman` (depending on distro) to find and install packages. And make sure you have `pip` to install Python-based command-line tools (a few below are easiest to install via `pip`). +- If you are a newcomer use `Nano` text editor, its the easiest to learn compared to `Vim` and `Emcas`. + ## Everyday use From 4e1abd4391ed786a35f80cbaa704b7bd0a19768c Mon Sep 17 00:00:00 2001 From: "Lakshmipathi.G" Date: Mon, 15 Feb 2016 01:40:37 +0530 Subject: [PATCH 02/10] basic calculator --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index e4029af..f62cca9 100644 --- a/README.md +++ b/README.md @@ -185,6 +185,11 @@ Notes: - For running a command with privileges, use `sudo` (for root) or `sudo -u` (for another user). Use `su` or `sudo bash` to actually run a shell as that user. Use `su -` to simulate a fresh login as root or another user. +- For a basic calculator (and of course access to Python in general), use `python` interpreter. For example, +``` +>>> 2+3 +5 +``` ## Processing files and data From f4544843b279ab60522628fced4b2f17ed5e34ee Mon Sep 17 00:00:00 2001 From: "Lakshmipathi.G" Date: Mon, 15 Feb 2016 01:48:01 +0530 Subject: [PATCH 03/10] prefer rsync over scp --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index f62cca9..359f5f5 100644 --- a/README.md +++ b/README.md @@ -244,6 +244,7 @@ Notes: ```sh mkdir empty && rsync -r --delete empty/ some-dir && rmdir some-dir ``` +Also use `rsync` instead of `scp`, so that after network interruption you resume the file transfer rather than restarting from scratch. - Use `shuf` to shuffle or select random lines from a file. From a38a24a1ed4bcfdeb1c2b1a8c07687b030fefde6 Mon Sep 17 00:00:00 2001 From: "Lakshmipathi.G" Date: Mon, 15 Feb 2016 02:00:50 +0530 Subject: [PATCH 04/10] fix typo: Emacs not Emcas --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 359f5f5..8958ee1 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ Notes: - Learn to use `apt-get`, `yum`, `dnf` or `pacman` (depending on distro) to find and install packages. And make sure you have `pip` to install Python-based command-line tools (a few below are easiest to install via `pip`). -- If you are a newcomer use `Nano` text editor, its the easiest to learn compared to `Vim` and `Emcas`. +- If you are a newcomer use `Nano` text editor, it's the easiest to learn compared to `Vim` and `Emacs`. ## Everyday use From e64c2f3c09dc8f5810e3c4f2e8e7117038f2eda9 Mon Sep 17 00:00:00 2001 From: "Lakshmipathi.G" Date: Mon, 15 Feb 2016 02:07:52 +0530 Subject: [PATCH 05/10] Verify disk space with lsof --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 8958ee1..69a91ea 100644 --- a/README.md +++ b/README.md @@ -312,6 +312,8 @@ Also use `rsync` instead of `scp`, so that after network interruption you resume - Use `dmesg` whenever something's acting really funny (it could be hardware or driver issues). +- If you delete a file and it doesn't free up expected disk space as reported by `du`, check whether the file is in use by a process: +`lsof | grep deleted | grep "filename-of-my-big-file"` ## One-liners From f8fc819af23bfb6469926a07f7f4dde17a41053f Mon Sep 17 00:00:00 2001 From: "Lakshmipathi.G" Date: Mon, 15 Feb 2016 02:11:02 +0530 Subject: [PATCH 06/10] 128K limit on commandline --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 69a91ea..b7bef5b 100644 --- a/README.md +++ b/README.md @@ -315,6 +315,8 @@ Also use `rsync` instead of `scp`, so that after network interruption you resume - If you delete a file and it doesn't free up expected disk space as reported by `du`, check whether the file is in use by a process: `lsof | grep deleted | grep "filename-of-my-big-file"` +- Know about the [128K limit](https://wiki.debian.org/CommonErrorMessages/ArgumentListTooLong) on command lines. This "Argument list too long" error is common when wildcard matching large numbers of files. (When this happens alternatives like `find` and `xargs` may help.) + ## One-liners A few examples of piecing together commands: From b1ad68b2151c9b1da6277a20da8402dcdb01d0dd Mon Sep 17 00:00:00 2001 From: "Lakshmipathi.G" Date: Mon, 15 Feb 2016 02:15:51 +0530 Subject: [PATCH 07/10] chattr to protect accidental file delete --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index b7bef5b..8910a5c 100644 --- a/README.md +++ b/README.md @@ -191,6 +191,9 @@ Notes: 5 ``` +- File attributes are settable via `chattr` and offer an alternative, lower-level alternative to file permissions. For example, to protect accidental file deletion the immutable flag: `sudo chattr +i /critical/directory/or/file` + + ## Processing files and data - To locate a file by name in the current directory, `find . -iname '*something*'` (or similar). To find a file anywhere by name, use `locate something` (but bear in mind `updatedb` may not have indexed recently created files). From fb7d95ea97f52403de20b5ce17a29b401a989389 Mon Sep 17 00:00:00 2001 From: "Lakshmipathi.G" Date: Mon, 15 Feb 2016 02:18:34 +0530 Subject: [PATCH 08/10] save and restore file permissions --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 8910a5c..769f767 100644 --- a/README.md +++ b/README.md @@ -193,6 +193,12 @@ Notes: - File attributes are settable via `chattr` and offer an alternative, lower-level alternative to file permissions. For example, to protect accidental file deletion the immutable flag: `sudo chattr +i /critical/directory/or/file` +- Use `getfacl` and `setfcle` to save and restore file permissions. For example: +```sh + getfacl -R /some/path > permissions.txt + setfacl --restore=permissions.txt +``` + ## Processing files and data From 0ee468155b4ad10447c6d72ad1f68cbf97f0cdc1 Mon Sep 17 00:00:00 2001 From: "Lakshmipathi.G" Date: Mon, 15 Feb 2016 02:22:42 +0530 Subject: [PATCH 09/10] Fix for review comments --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 769f767..3dc5d5c 100644 --- a/README.md +++ b/README.md @@ -191,9 +191,9 @@ Notes: 5 ``` -- File attributes are settable via `chattr` and offer an alternative, lower-level alternative to file permissions. For example, to protect accidental file deletion the immutable flag: `sudo chattr +i /critical/directory/or/file` +- File attributes are settable via `chattr` and offer a lower-level alternative to file permissions. For example, to protect against accidental file deletion the immutable flag: `sudo chattr +i /critical/directory/or/file` -- Use `getfacl` and `setfcle` to save and restore file permissions. For example: +- Use `getfacl` and `setfacl` to save and restore file permissions. For example: ```sh getfacl -R /some/path > permissions.txt setfacl --restore=permissions.txt From 6b13ea552da86236e3b54ac3524e0e9fdf531dd1 Mon Sep 17 00:00:00 2001 From: "Lakshmipathi.G" Date: Tue, 16 Feb 2016 16:55:50 +0530 Subject: [PATCH 10/10] Remove nano tip --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 3dc5d5c..b1c2685 100644 --- a/README.md +++ b/README.md @@ -71,8 +71,6 @@ Notes: - Learn to use `apt-get`, `yum`, `dnf` or `pacman` (depending on distro) to find and install packages. And make sure you have `pip` to install Python-based command-line tools (a few below are easiest to install via `pip`). -- If you are a newcomer use `Nano` text editor, it's the easiest to learn compared to `Vim` and `Emacs`. - ## Everyday use