From 9fd62a73ae86500637c35d5c11552b08a932f93d Mon Sep 17 00:00:00 2001 From: Donne Martin Date: Wed, 11 Mar 2015 20:30:23 -0400 Subject: [PATCH] Added sed command to delete matching lines in place. Added command to display all matching running processes with full formatting. Tweaked formatting of vim section regarding vimtutor and vim syntax coloring. --- commands/linux.ipynb | 68 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 58 insertions(+), 10 deletions(-) diff --git a/commands/linux.ipynb b/commands/linux.ipynb index 92a6931..3c90cc2 100644 --- a/commands/linux.ipynb +++ b/commands/linux.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:4515e5f88373961da62945f02e97b93ca0c73478b952696d14d5cd396af307f1" + "signature": "sha256:aa55f3f5af827289e0e805beeac7bc3bafcc5a85403717370daaa909851ea0c4" }, "nbformat": 3, "nbformat_minor": 0, @@ -16,7 +16,7 @@ "\n", "* Disk Usage\n", "* Splitting Files\n", - "* Grep\n", + "* Grep, Sed\n", "* Compression\n", "* Curl\n", "* View Running Processes\n", @@ -178,14 +178,14 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Grep" + "## Grep, Sed" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "Check number of files matching \u201c.txt\":" + "List number of files matching \u201c.txt\":" ] }, { @@ -215,6 +215,23 @@ "metadata": {}, "outputs": [] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Delete matching lines in place:" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "sed -i '/Important Lines: /d\u2019 original_file" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, { "cell_type": "markdown", "metadata": {}, @@ -313,6 +330,9 @@ "# Display all running processes\n", "ps aux | less\n", "\n", + "# Display all matching running processes with full formatting\n", + "ps -ef | grep python\n", + "\n", "# See processes run by user dmartin\n", "ps -u dmartin\n", "\n", @@ -406,12 +426,40 @@ "Paste the current line: p (P for paste above cursor)\n", "\n", "Quit without saving changes: q!\n", - "Write the current file and quit: :wq\n", - "\n", - "# Run the following command to enable the tutorial\n", - "vimtutor\n", - "\n", - "# Run the following commands to enable syntax colors\n", + "Write the current file and quit: :wq" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Run the following command to enable the tutorial:" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "vimtutor" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Run the following commands to enable syntax colors:" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ "cd ~\n", "vim .vimrc\n", "syntax on\n",