mirror of
https://github.com/donnemartin/data-science-ipython-notebooks.git
synced 2024-03-22 13:30:56 +08:00
Prefixed Linux commands with ! so they can be executed within IPython Notebook.
This commit is contained in:
parent
23d3866b8e
commit
a9ea93b872
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"metadata": {
|
||||
"name": "",
|
||||
"signature": "sha256:aa55f3f5af827289e0e805beeac7bc3bafcc5a85403717370daaa909851ea0c4"
|
||||
"signature": "sha256:7cdf1e36fef9e69cd9007eb0c5945e4d6440b31108bfddd6f19aa71d0d1a06ab"
|
||||
},
|
||||
"nbformat": 3,
|
||||
"nbformat_minor": 0,
|
||||
|
@ -42,7 +42,7 @@
|
|||
"cell_type": "code",
|
||||
"collapsed": false,
|
||||
"input": [
|
||||
"df -h"
|
||||
"!df -h"
|
||||
],
|
||||
"language": "python",
|
||||
"metadata": {},
|
||||
|
@ -59,7 +59,7 @@
|
|||
"cell_type": "code",
|
||||
"collapsed": false,
|
||||
"input": [
|
||||
"du -h ./"
|
||||
"!du -h ./"
|
||||
],
|
||||
"language": "python",
|
||||
"metadata": {},
|
||||
|
@ -76,7 +76,7 @@
|
|||
"cell_type": "code",
|
||||
"collapsed": false,
|
||||
"input": [
|
||||
"du -sh ../"
|
||||
"!du -sh ../"
|
||||
],
|
||||
"language": "python",
|
||||
"metadata": {},
|
||||
|
@ -93,7 +93,7 @@
|
|||
"cell_type": "code",
|
||||
"collapsed": false,
|
||||
"input": [
|
||||
"du -csh ./"
|
||||
"!du -csh ./"
|
||||
],
|
||||
"language": "python",
|
||||
"metadata": {},
|
||||
|
@ -117,7 +117,7 @@
|
|||
"cell_type": "code",
|
||||
"collapsed": false,
|
||||
"input": [
|
||||
"wc -l < file.txt"
|
||||
"!wc -l < file.txt"
|
||||
],
|
||||
"language": "python",
|
||||
"metadata": {},
|
||||
|
@ -134,7 +134,7 @@
|
|||
"cell_type": "code",
|
||||
"collapsed": false,
|
||||
"input": [
|
||||
"grep -c \".\" file.txt"
|
||||
"!grep -c \".\" file.txt"
|
||||
],
|
||||
"language": "python",
|
||||
"metadata": {},
|
||||
|
@ -151,7 +151,7 @@
|
|||
"cell_type": "code",
|
||||
"collapsed": false,
|
||||
"input": [
|
||||
"split -l 20 file.txt new"
|
||||
"!split -l 20 file.txt new"
|
||||
],
|
||||
"language": "python",
|
||||
"metadata": {},
|
||||
|
@ -168,7 +168,7 @@
|
|||
"cell_type": "code",
|
||||
"collapsed": false,
|
||||
"input": [
|
||||
"split -l 802 -a 1 file.csv dir/part-user-csv.tbl-"
|
||||
"!split -l 802 -a 1 file.csv dir/part-user-csv.tbl-"
|
||||
],
|
||||
"language": "python",
|
||||
"metadata": {},
|
||||
|
@ -192,7 +192,7 @@
|
|||
"cell_type": "code",
|
||||
"collapsed": false,
|
||||
"input": [
|
||||
"ls -1 | grep .txt | wc -l"
|
||||
"!ls -1 | grep .txt | wc -l"
|
||||
],
|
||||
"language": "python",
|
||||
"metadata": {},
|
||||
|
@ -209,7 +209,7 @@
|
|||
"cell_type": "code",
|
||||
"collapsed": false,
|
||||
"input": [
|
||||
"cat * | grep -c \"foo\" folder/part*"
|
||||
"!cat * | grep -c \"foo\" folder/part*"
|
||||
],
|
||||
"language": "python",
|
||||
"metadata": {},
|
||||
|
@ -226,7 +226,7 @@
|
|||
"cell_type": "code",
|
||||
"collapsed": false,
|
||||
"input": [
|
||||
"sed -i '/Important Lines: /d\u2019 original_file"
|
||||
"!sed -i '/Important Lines: /d\u2019 original_file"
|
||||
],
|
||||
"language": "python",
|
||||
"metadata": {},
|
||||
|
@ -244,31 +244,31 @@
|
|||
"collapsed": false,
|
||||
"input": [
|
||||
"# Compress zip\n",
|
||||
"zip -r archive_name.zip folder_to_compress\n",
|
||||
"!zip -r archive_name.zip folder_to_compress\n",
|
||||
"\n",
|
||||
"# Compress zip without invisible Mac resources\n",
|
||||
"zip -r -X archive_name.zip folder_to_compress\n",
|
||||
"!zip -r -X archive_name.zip folder_to_compress\n",
|
||||
"\n",
|
||||
"# Extract zip\n",
|
||||
"unzip archive_name.zip\n",
|
||||
"!unzip archive_name.zip\n",
|
||||
"\n",
|
||||
"# Compress TAR.GZ\n",
|
||||
"tar -zcvf archive_name.tar.gz folder_to_compress\n",
|
||||
"!tar -zcvf archive_name.tar.gz folder_to_compress\n",
|
||||
"\n",
|
||||
"# Extract TAR.GZ\n",
|
||||
"tar -zxvf archive_name.tar.gz\n",
|
||||
"!tar -zxvf archive_name.tar.gz\n",
|
||||
"\n",
|
||||
"# Compress TAR.BZ2\n",
|
||||
"tar -jcvf archive_name.tar.bz2 folder_to_compress\n",
|
||||
"!tar -jcvf archive_name.tar.bz2 folder_to_compress\n",
|
||||
"\n",
|
||||
"# Extract TAR.BZ2\n",
|
||||
"tar -jxvf archive_name.tar.bz2\n",
|
||||
"!tar -jxvf archive_name.tar.bz2\n",
|
||||
"\n",
|
||||
"# Extract GZ\n",
|
||||
"gunzip archivename.gz\n",
|
||||
"!gunzip archivename.gz\n",
|
||||
"\n",
|
||||
"# Uncompress all tar.gz in current directory to another directory\n",
|
||||
"for i in *.tar.gz; do echo working on $i; tar xvzf $i -C directory/ ; done"
|
||||
"!for i in *.tar.gz; do echo working on $i; tar xvzf $i -C directory/ ; done"
|
||||
],
|
||||
"language": "python",
|
||||
"metadata": {},
|
||||
|
@ -286,28 +286,28 @@
|
|||
"collapsed": false,
|
||||
"input": [
|
||||
"# Display the curl output:\n",
|
||||
"curl donnemartin.com\n",
|
||||
"!curl donnemartin.com\n",
|
||||
"\n",
|
||||
"# Download the curl output to a file:\n",
|
||||
"curl donnemartin.com > donnemartin.html\n",
|
||||
"!curl donnemartin.com > donnemartin.html\n",
|
||||
"\n",
|
||||
"# Download the curl output to a file -o\n",
|
||||
"curl -o image.png http://i1.wp.com/donnemartin.com/wp-content/uploads/2015/02/splunk_cover.png\n",
|
||||
"!curl -o image.png http://i1.wp.com/donnemartin.com/wp-content/uploads/2015/02/splunk_cover.png\n",
|
||||
"\n",
|
||||
"# Download the curl output to a file, keeping the original file name -O\n",
|
||||
"curl -O http://i1.wp.com/donnemartin.com/wp-content/uploads/2015/02/splunk_cover.png\n",
|
||||
"!curl -O http://i1.wp.com/donnemartin.com/wp-content/uploads/2015/02/splunk_cover.png\n",
|
||||
" \n",
|
||||
"# Download multiple files, attempting to reuse the same connection\n",
|
||||
"curl -O url1 -O url2\n",
|
||||
"!curl -O url1 -O url2\n",
|
||||
"\n",
|
||||
"# Follow redirects -L\n",
|
||||
"curl -L url\n",
|
||||
"!curl -L url\n",
|
||||
"\n",
|
||||
"# Resume a previous download -C -\n",
|
||||
"curl -C - -O url\n",
|
||||
"!curl -C - -O url\n",
|
||||
"\n",
|
||||
"# Authenticate -u\n",
|
||||
"curl -u username:password url"
|
||||
"!curl -u username:password url"
|
||||
],
|
||||
"language": "python",
|
||||
"metadata": {},
|
||||
|
@ -325,19 +325,19 @@
|
|||
"collapsed": false,
|
||||
"input": [
|
||||
"# Display sorted info about processes\n",
|
||||
"top\n",
|
||||
"!top\n",
|
||||
"\n",
|
||||
"# Display all running processes\n",
|
||||
"ps aux | less\n",
|
||||
"!ps aux | less\n",
|
||||
"\n",
|
||||
"# Display all matching running processes with full formatting\n",
|
||||
"ps -ef | grep python\n",
|
||||
"!ps -ef | grep python\n",
|
||||
"\n",
|
||||
"# See processes run by user dmartin\n",
|
||||
"ps -u dmartin\n",
|
||||
"!ps -u dmartin\n",
|
||||
"\n",
|
||||
"# Display running processes as a tree\n",
|
||||
"pstree"
|
||||
"!pstree"
|
||||
],
|
||||
"language": "python",
|
||||
"metadata": {},
|
||||
|
@ -381,7 +381,7 @@
|
|||
"cell_type": "code",
|
||||
"collapsed": false,
|
||||
"input": [
|
||||
"source ~/.bash_profile"
|
||||
"!source ~/.bash_profile"
|
||||
],
|
||||
"language": "python",
|
||||
"metadata": {},
|
||||
|
@ -443,7 +443,7 @@
|
|||
"cell_type": "code",
|
||||
"collapsed": false,
|
||||
"input": [
|
||||
"vimtutor"
|
||||
"!vimtutor"
|
||||
],
|
||||
"language": "python",
|
||||
"metadata": {},
|
||||
|
@ -460,8 +460,9 @@
|
|||
"cell_type": "code",
|
||||
"collapsed": false,
|
||||
"input": [
|
||||
"cd ~\n",
|
||||
"vim .vimrc\n",
|
||||
"!cd ~\n",
|
||||
"!vim .vimrc\n",
|
||||
"# Add the following to ~/.vimrc\n",
|
||||
"syntax on\n",
|
||||
":wq"
|
||||
],
|
||||
|
|
Loading…
Reference in New Issue
Block a user