命令显示内容解释:
[[email protected] ~]# cat /etc/passwd root:x:0:0:root:/root:/bin/bash#(用户名:用户密码:用户ID:用户组ID:注释:用户主目录:该用户所使用解析器)
[[email protected] ~]# ll total 64 -rw------- 1 root root 885 Aug 26 07:59 anaconda-ks.cfg
#d|rw-|---|---(第一个代表文件类型,第二个代表文件所有者的权限,第三个代表文件所在组的权限,第四个代表其他组用户的权限),1表示这是一个文件,885表示文件大小,Aug 26 07:59表示创建日期,anaconda-ks.cfg表示文件名.
文件类型的-代表普通文件d代表是文件夹l代表链接
r/4代表可读;
w/2代表可写;
x/1代表可执行
命令学习:
startx#进入图形界面(redhat5.5)#不同版本命令不同 shutdown -h now#立即关机 shudown -r now#立即重启 reboot#立即重启 ls#查看目录 pwd#显示当前路径 useradd {username}#添加用户 passwd [username]#给user修改密码 userdel [username]#删除user但不删除文件夹 userdel -r [username]#删除user同时删除文件夹 cd {dir}#切换路径 mkdir {dirname}#创建文件夹 rmdir {dirname}#删除空的文件夹 rm {filename}#删除文件 cp {filename} {dir} #拷贝文件到指定路径 | more#显示内容,分页 less#分页显示内容 grep "{string}" {filename}#查找 grep -n "{string}" {filename}#查找,显示行数 man#相当于帮助 find /[dir] {filename} #查找文件和目录 >#重定向(覆盖) >>#重定向(追加) ls -ahl#显示文件的组 groupadd {groupname}#增加用户组 cat /etc/group#查看所有组,但不能修改 useradd [-g {filename}] {username}#添加用户到指定组 cat /etc/passwd#查看用户所在的组 chmod {0-7}{0-7}{0-7} {filename}#修改文件权限
以下内容来自于
http://lxq937592436.blog.51cto.com/6616077/1688961
[[email protected] ~]# df -h #查看分区情况 Filesystem Size Used Avail Use% Mounted on /dev/sda3 18G 900M 16G 6% / tmpfs 504M 0 504M 0% /dev/shm /dev/sda1 190M 24M 157M 13% /boot
[[email protected] ~]# ifconfig [[email protected] ~]# ifconfig -a [[email protected] ~]# dhclient #自动获取ip地址 [[email protected] ~]# killall dhclient
[[email protected] ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 #把ifcfg-eth0文件的信息打印到屏幕上 DEVICE=eth0 #网卡名称 HWADDR=00:0C:29:C0:E6:3F TYPE=Ethernet UUID=0d6e10a4-ab03-4963-8213-c9b4dfa8c223 ONBOOT=yes #yes表示开机自动启动,no表示开机不自动启动 NM_CONTROLLED=yes BOOTPROTO=static #static表示是静态IP,dhcp表示是自动获得 IPADDR=192.168.80.66 #IP地址 NETMASK=255.255.255.0 #子网掩码 GATEWAY=192.168.80.2 #网关 DNS1=192.168.80.2 #DNS地址 DNS2=114.114.114.114
[[email protected] ~]# curl www.qq.com #通过命令行测试能不能上网
[[email protected] ~]# yum list | wc -l #wc -l统计行数 5143
[[email protected] ~]# LANG=en_US #把语言环境变为美式英语环境,该设置仅临时生效 [[email protected] ~]# LANG=zh_CN.utf8 #把语言环境变为中文环境,该设置仅临时生效 [[email protected] ~]# yum grouplist | more #查看所有可以安装的yum源 [[email protected] ~]# yum groupinstall -y "Desktop" #安装桌面环境,前提是语言环境必须为美式英语环境
[[email protected] ~]# cd /etc/yum.repos.d/ [[email protected] yum.repos.d]# ls CentOS-Base.repo CentOS-fasttrack.repo CentOS-Vault.repo CentOS-Debuginfo.repo CentOS-Media.repo [[email protected] yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bak [[email protected] yum.repos.d]# mount /dev/cdrom /mnt/ mount: block device /dev/sr0 is write-protected, mounting read-only [[email protected] yum.repos.d]
[[email protected] yum.repos.d]# cat CentOS-Media.repo # CentOS-Media.repo # # This repo can be used with mounted DVD media, verify the mount point for # CentOS-6. You can use this repo and yum to install items directly off the # DVD ISO that we release. # # To use this repo, put in your DVD and use it with the other repos too: # yum --enablerepo=c6-media [command] # # or for ONLY the media repo, do this: # # yum --disablerepo=\* --enablerepo=c6-media [command]
[c6-media] name=CentOS-$releasever - Media baseurl=file:///media/CentOS/ file:///media/cdrom/ file:///media/cdrecorder/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
[[email protected] yum.repos.d]# vi CentOS-Media.repo [[email protected] yum.repos.d]# cat CentOS-Media.repo # CentOS-Media.repo # # This repo can be used with mounted DVD media, verify the mount point for # CentOS-6. You can use this repo and yum to install items directly off the # DVD ISO that we release. # # To use this repo, put in your DVD and use it with the other repos too: # yum --enablerepo=c6-media [command] # # or for ONLY the media repo, do this: # # yum --disablerepo=\* --enablerepo=c6-media [command]
[c6-media] name=CentOS_bendiyum baseurl=file:///mnt # file:///media/cdrom/ # file:///media/cdrecorder/ #gpgcheck=1 enabled=1 #gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
时间: 2024-10-12 04:34:49