Yanfei Kang
yanfeikang@buaa.edu.cn
School of Economics and Management
Beihang University
http://yanfei.site
# Who am I?
whoami
# Where we are?
pwd
pwd
whoami
yanfei /home/yanfei/lectures /home/yanfei/lectures yanfei
# What's in our current location?
ls
BDE-L0-intro.ipynb BDE-L1-bigdata.slides.html figs BDE-L0-intro.slides.html BDE-L2-linux.ipynb BDE-L1-bigdata.ipynb BDE-L2-linux.slides.html
ls
BDE-L0-intro.ipynb BDE-L1-bigdata.ipynb BDE-L2-linux.ipynb figs
ls /home/yanfei/lectures
BDE-L0-intro.ipynb BDE-L1-bigdata.ipynb BDE-L2-linux.ipynb figs
~
(tilde) - This is a shortcut for your home directory. /home/yanfei/lectures
or ~/lectures
..
(dot) - This is a reference to your current directory. ls ./
.ls ../
.cd
which stands for change directory.man ls
.ls -lhsta
total 892K 4.0K drwxr-xr-x 4 yanfei yanfei 4.0K Sep 6 19:16 . 20K -rw-r--r-- 1 yanfei yanfei 19K Sep 6 19:16 BDE-L2-linux.ipynb 4.0K -rw-rw-r-- 1 yanfei yanfei 166 Sep 6 19:12 output 4.0K -rw-r--r-- 1 yanfei yanfei 3.0K Sep 6 18:53 BDE-L0-intro.ipynb 292K -rw-rw-r-- 1 yanfei yanfei 291K Sep 5 15:25 BDE-L2-linux.slides.html 276K -rw-rw-r-- 1 yanfei yanfei 275K Sep 5 15:25 BDE-L1-bigdata.slides.html 276K -rw-rw-r-- 1 yanfei yanfei 274K Sep 5 15:25 BDE-L0-intro.slides.html 4.0K drwxr-xr-x 2 yanfei yanfei 4.0K Sep 4 18:11 figs 4.0K -rw-r--r-- 1 yanfei yanfei 3.0K Sep 4 17:44 BDE-L1-bigdata.ipynb 4.0K drwxr-xr-x 2 yanfei yanfei 4.0K Sep 4 17:44 .ipynb_checkpoints 4.0K drwxr-xr-x 9 yanfei yanfei 4.0K Sep 4 16:12 ..
cd
and ls
to explore what directories are on your system and what's in them. Make sure you use a variety of relative and absolute paths.
mkdir
rmdir
touch
cp
mv
rm
vim firstfile
.cat firstfile
.less
.head
, tail
.head BDE-L0-intro.slides.html
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="chrome=1" /> <meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
Now let's go back into the file we just created and enter some more content. In insert mode you may use the arrow keys to move the cursor around. Enter two more paragraphs of content then hit Esc to go back to edit mode.
# Examples
ls B*
ls *.????b
ls *[0-1]*
ls */*.png
ls -lhsa /home/*/.bash_history
BDE-L0-intro.ipynb BDE-L1-bigdata.ipynb BDE-L2-linux.ipynb BDE-L0-intro.ipynb BDE-L1-bigdata.ipynb BDE-L2-linux.ipynb BDE-L0-intro.ipynb BDE-L1-bigdata.ipynb figs/bigdata.png 4.0K -rw-r--r-- 1 yanfei yanfei 560 Sep 4 18:02 /home/yanfei/.bash_history
ls > output
cat output
BDE-L0-intro.ipynb BDE-L0-intro.slides.html BDE-L1-bigdata.ipynb BDE-L1-bigdata.slides.html BDE-L2-linux.ipynb BDE-L2-linux.slides.html figs output
wc -l output
wc -l output >> output
cat output
8 output BDE-L0-intro.ipynb BDE-L0-intro.slides.html BDE-L1-bigdata.ipynb BDE-L1-bigdata.slides.html BDE-L2-linux.ipynb BDE-L2-linux.slides.html figs output 8 output
ls | head -3
BDE-L0-intro.ipynb BDE-L0-intro.slides.html BDE-L1-bigdata.ipynb