CentOS
2015-04-21 22:23 Wizardlsw 阅读(345) 评论(0) 编辑 收藏 举报AZURE CentOS Root password:
https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-linux-use-root-privileges/
http://stackoverflow.com/questions/36190762/how-do-i-fix-port-80-requires-elevated-privileges-on-windows-azure-with-node-j --not tried yet
http://stackoverflow.com/questions/31472755/sudo-npm-command-not-found -- not tried yet
http://www.dayanmei.com/windows_azure_centos_password/
https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-set-up-endpoints/ (to be read)
https://codex.wordpress.org/Changing_File_Permissions
List all groups
Have you tried this command
groups
for entire group list use
cut -d: -f1 /etc/group | sort
User and Group (uid, gid, groups, etc)
$ id <user-name>
Output example:
[slin_ftp_root@web-dev ~]$ id root
uid=0(root) gid=0(root) groups=0(root)
Add user to group(s):
$ sudo usermod -a -G <group-name1>,<group-name2> <user-name>
Remove user from a group:
$ sudo gpasswd -d <user-name> <group-name>
If you want to change the user owning this file or directory (folder), you will have to use the command chown
. For instance, if you run
sudo chown <username> <myfolder>
the user owning myfolder will be username. Then you can execute
sudo chmod u+w myfolder
For group, try:
sudo chgrp <groupname> <myfolder>
the group owning myfolder will be the <groupname>. Then you can execute:
sudo chmod g+w myfolder
To add the write permission to the username user.
But if you want to add this user to the group associated with "myfolder", you can run
sudo usermod -a -G groupname username
and then execute
sudo chmod g+w myfolder
to add the write permission to the group.
to check it, you can run:
ls -al <myfolder>
另一份笔记: http://www.cnblogs.com/swlin/p/3504392.html
LINUX 面试题: http://blog.csdn.net/BOXsoldier/article/details/6857075
CentOS 5中 make: g++ command not found
yum 更换阿里云的源 http://ju.outofmemory.cn/entry/91040
下载PUTTY: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html http://www.putty.org/
PUTTY中的复制与粘贴:http://www.cnblogs.com/lidp/archive/2009/12/17/1697441.html
查看具体什么类型的操作系统
- cat /proc/version
Linux version 3.10.0-229.1.2.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC) ) #1 SMP Fri Mar 27 03:04:26 UTC 2015
- cat /etc/redhat-release
CentOS Linux release 7.1.1503 (Core)
- uname -a 或者 uname -r
查看文件内容
- less
- more
- cat
文本编辑工具 VIM
i 插入,:wq 保存并退出, :q! 退出不保存
查看用户列表: http://www.cyberciti.biz/faq/linux-list-users-command/
- $ cat /etc/passwd
- $ more /etc/passwd 或者 less /etc/passwd
- $ awk -F':' '{ print $1}' /etc/passwd
查看环境变量 (http://soft.chinabyte.com/os/169/11412169.shtml)
$ echo $PATH #还有$HOME等等
$ env #查看所有环境变量
$ export HELLO="Hello!" #添加一个新的环境变量
切换帐户 (http://linuxso.com/command/su.html)
su username #切换到其他用户,但是不切换环境变量
su - username #是完整的切换到一个用户环境
另外关于权限下放的一个命令: sudo
添加用户并设置密码
# adduser username
# passwd username #to set the password
删除用户/delete user/remove user
# userdel username #remove a user from local Linux system/workstation
# userdel -r username #delete the user’s home directory and mail spool pass the -r option to userdel for a user named
IO重定向
http://blog.csdn.net/jiyanfeng1/article/details/8164714
查看进程/端口
$ ps aux 或者 $ ps aux | grep nginx
$ netstat -apn OR netstat -ltunp
先使用ps -e | grep nginx查看是否已经启动了nginx,如果没有的话则按照提示,查看0.0.0.0:80端口谁占用了,使用netstat -ltunp命令。
查看进程对应的目录 http://blog.csdn.net/kankan_summer/article/details/8181837
通过netstat -apn 找到对应进程的PID,再用以下语句中一任一条:
$ ls -l /proc/PID/exe
$ file /proc/PID/exe
停止/杀死进程
kill -s QUIT <PID>
查看当前目录
pwd
复制目录及文件
cp dir1 dir2 #only copy the structure
cp dir1/* dir2 -riu #u overwrite updated only| i : interactive覆盖访问 | r: 递归目录
-n, --no-clobber
do not overwrite an existing file (overrides a previous -i option)
移动目录及文件
mv dir1 dir2
删除目录及文件
rm dir1 -r
rm dir1 -rf #删除目录
查看本机IP
- ip addr show
- ifconfig
nohup : http://www.cnblogs.com/allenblogs/archive/2011/05/19/2051136.html
其它:
别名: 在Windows 与 Linux 之间,总要记住 cls 或clear来清屏,经常出错,所以可以在Linux中使用“ alias cls='clear' ” 来给clear取个别名, 这样子在Linux中也可以使用cls!