Linux
环境配置
- How To Install Ruby on Rails with rbenv on CentOS 7
- How To Install Ruby on Rails on CentOS 6
- How To Add Swap on CentOS 7
查看占用端口
ps -ef | grep port
查看内存使用
free -m
安装 sftp
apt-get install openssh-server
启动
/etc/init.d/ssh start
启动后直接通过 ftp 客户端登录,用户名密码为系统用户名和密码
apt-get
apt-get
apt-get install app-name
apt-get autoremove app-name
解压到指定目录
unzip file.zip -d destination_folder
不知道为什么当时 ubuntu 好像不能直接使用 unzip 命令,后来通过 apt get install 安装到
获取对目录下文件的操作权限
chown your_username directory
给用户增加 sudo
visudo
打开后,添加 newuser 一行
# User privilege specification
root ALL=(ALL:ALL) ALL
newuser ALL=(ALL:ALL) ALL
查看当前 tcp 监听端口
netstat -tl
如何把 tar.gz 格式文件解压到指定目录
格式 :#tar zxvf *.tar.gz -C 您想指定的目录。一个简单例子:比如把 kleandisk-2.1.tar.gz 解压后,释放到/home/cao 目录下。可以这样: #tar zxvf kleandisk-2.1.tar.gz -C /home/cao
安装 node 后设置环境变量
http://www.cnblogs.com/hdk1993/p/4509302.html
/etc/profile 是所有用户的环境变量 在/etc/profile 中增加 export PATH="$PATH:/home/***/android-sdk-linux_86/platform-tools/" 完成设置 使生效
source profile
查找进程占用端口
ps -ef | grep 8080
netstat -tulpn | grep :8080
查看 linux 发行版信息
https://www.cyberciti.biz/faq/find-linux-distribution-name-version-number/
cat /etc/*-release
设备信息
GPU
https://askubuntu.com/questions/5417/how-to-get-the-gpu-info
lspci | grep ' VGA ' | cut -d" " -f 1 | xargs -i lspci -v -s {}
磁盘
磁盘使用
df -H
列出文件大小
https://unix.stackexchange.com/questions/64148/how-do-i-make-ls-show-file-sizes-in-megabytes
ls -l --block-size=M