linux command tips
整理命令定位、重新加载 Bash 配置和使用 here-document 等 Linux 命令行技巧。
了解命令的方法
以ping为例
which pingwhatis pingwhereis pingman pingtype pingtype ping显示
ping is /sbin/ping
type source显示
source is a shell builtin
重载 bash profile
重新载入 profile文件,以免登出再登入终端
source /etc/profilesource命令的作用是运行指定文件的内容作为当前shell的参数,可以用.号代替。
举例,将phantomjs移至/usr/local/bin中,此时用tab键还是无法补全命令,但source之后,tab补全将可用
cat <<EOF 与cat <<-EOF
常见用法是把输入输出到一个文件中,比如scrapy中的示例
cat > myspider.py <<EOF用这种方法添一行文字到一个新文件很方便。至于不同之处,两者都是获取stdin,并在EOF处结束stdin。但-EOF会去掉所在行前的tab,注意,只是tab,不包括空格
原图已从源站删除:原始图片地址