[BashShell]_[Shell编程]


1.添加命令到环境变量

vi ~/.bash_profile
增加一行

export path=$path:/path1:/path2:/pahtN

保存退出


2.增加显示文件命令ls,以列表,属性,颜色,文件特征显示文件。

vi ~/.bash_profile

增加一行

alias ll="ls -laGF"

保存退出


执行立即生效

source ~/.bash_profile 

3.定时任务

sudo crontab -e

30 21 * * * /sbin/shutdown -h +0
21 14 * * * /sbin/shutdown -h +0


4.curl使用代理访问网络.

curl -x 192.168.0.1:808 -U user:password -p  www.baidu.com


5.打包文件夹,并过滤掉特定文件,比如备份的时候.

tar --exclude *.dmg --exclude dist/ --exclude build/ -czf test.tar.gz pdf2
tar -tf test.tar.gz pdf2
tar -xf test.tar.gz

-- 打包test文件夹为test.tar.gz,排除.dmg后缀名的文件.

-- 列举文件内容

-- 解压。


6.创建软链接

ln -s /Volumes/BOOTCAMP/参考/iOS .



你可能感兴趣的:(shell,mac,OS,环境变量,X)