Fedora8常用命令(技能大赛)
fedora命令大全

fedora命令大全一、安装和登陆命令1、startx进入图形界面2、init 5进入图形界面3、init 3进入字符界面4、login登陆5、poweroff关机-p 关闭机器的时候关闭电源-n 在关闭机器时不同步数据-w 不做关机的操作,只是把这个操作记录到日志里-d 不把关机的信息记录到日志文件里-f 不调用shutdown6、shutdown关机重启命令格式:shutdown [选项] 时间[信息]时间是必要参数,一定要加,可以用now,也可以用+5信息在关机的时候给用户的信息-t 这个参数后面需要加数字,比如5,表示在发出关机信号5秒后开始关机-k 不做真正的关机,只是通知一下所有的用户。
-r 重启计算机-h 关机后关闭电源-f 在重新启动的时候跳过fsck(磁盘检查程序)-F 重启时,忽略fsck程序(同-f一样)-c 取消已在执行的关机动作例:#shutdown -k now just kid#shutdown -h now system shut down now7、halt关机,选项同poweroff一样8、reboot重启计算机9、mount挂载文件系统umount卸载文件系统挂载光盘#mount -t iso9660 /dev/cdrom /mnt/cdrom 或者#mount /mnt/cdrom 卸载光盘#umount /mnt/cdrom退出光盘#eject送入光盘#eject -t挂载软盘#mount /mnt/floppy卸载软盘#umount /mnt/floppy挂载本地FAT32分区,并使挂载后显示中文#mount -t vfat -o iocharset=cp936 /dev/hda1 /mnt/win卸载#/umount /mnt/win挂载U盘或者移动硬盘#mount -o iocharset=utf8 /dev/sda1 /mnt/usb卸载 #umount /mnt/usb如果本地语言环境不是utf8,而是gb18030,需使用下面的命令挂载#mount -o iocharset=gb2312 /dev/sda1 /mnt/usb 挂载一个光盘镜像至本地/mnt/cdrom目录,用下面的命令#mount -t iso9660 -o loop /tmp/cd.iso /mnt/cdrom10、linux text字符界面下安装操作系统的命令11、linux askmethod 选择不同方法安装操作系统的命令二、图形化界面相关命令1、setup系统设置2、ntsysv服务启动设置3、gdmsetup / gdmconfig 登陆设置4、networkconfig / thizconfig 网络设置5、gnome-volume-control音量控制6、kcontrol KDE控制中心7、kpersonalizer KDE设置向导8、xmtr 网络检测命令三、信息显示命令1、time显示特定指令执行时所需消耗的时间及系统资源等资讯2、data 显示或设定系统的日期与时间若是不以加号作为开头,则表示要设定时间,而时间格式为MMDDhhmm[[CC]YY][.ss],其中MM 为月份,DD 为日,hh 为小时,mm 为分钟,CC 为年份前两位数字,YY 为年份后两位数字,ss 为秒数#date 0811********.35 3、cal 显示日历#cal –m #cal –s #cal 2006 #cal 08 20064、uptime提供使用者下面的资讯,不需其他参数:现在的时间系统开机运转到现在经过的时间连线的使用者数量最近一分钟、五分钟和十五分钟的系统负载参数:-V 显示版本资讯5、last 显示系统开机以来或是从每月初登入者的讯息6、dmesg显示系统启动的信息7、uname 显示系统信息-m 显示硬件型号-n 显示主机名-r 显示内核版本-S 显示操作系统类型-V 显示操作系统的版本-a 显示全部信息8、id 显示真实和有效的UID和GID9、hostname 显示或设置系统的主机名-a 显示主机的别名-d 显示DNS域名-F 从指定文件中读取主机名-i 显示主机的IP地址10、who或w 显示在线登陆用户-q 显示全部的登陆名和登陆数#w 显示系统中当前用户的信息#w user username 仅显示指定用户的信息11、whoami显示用户自己的身份12、whois 查询域名注册及IP地址相关信息#whois /doc/4e3608708.html,小技巧:如果想注册一个域名,可以用whois工具查询一下是否有人注册。
Fedora Linux 系统调用或常用命令详细解析 roqet

NAMEroqet − Rasqal RDF query utilitySYNOPSISroqet[OPTIONS]<query-URI> [base-URI]roqet[OPTIONS]-e query-string [base-URI]DESCRIPTIONThe roqet utility allows querying of RDF content using the Rasqal RDF query library,printing the results in variable bindings, RDF graph or boolean format.The query is read from query-URI and the optional base-URI is used as the base URI of the query if present.MAIN OPTIONSroqet uses the usual GNU command line syntax, with long options starting with two dashes (‘-’) if sup-ported by the getopt_long function.Otherwise only the short options are available.−e, −−exec QUERYExecute the query in the argument QUERY instead of reading the query from a URI (when -e isnot given).−i, −−input LANGUAGESet the input query LANGUAGE to one of’sparql’ (SPARQL Query Language for RDF,default) or’rdql’ (RDF Data Query Language).The list of supported languages is given in the help summarygiven by−h.−r,−−results FORMATSet the query results format.For variable bindings, the values of FORMAT vary upon what Rasqal supports but include ’sim-ple’ for a simple text format (default), ’xml’ for the SPARQL Query Results XML format and’json’ for a JSON version of the results.For RDF graph results, the values of FORMAT are ’ntriples’ (N-Triples, default), ’rdfxml-abbrev’(RDF/XML Abbreviated), ’rdfxml’ (RDF/XML), ’turtle’ (Turtle), ’json’ (RDF/JSON resourcecentric), ’json-triples’ (RDF/JSON triples) or ’rss-1.0’ (RSS 1.0, also an RDF/XML syntax).The exact list of formats depends on what libraptor(3) was built with but is given correct in theusage message with −h.OTHER OPTIONS−c, −−countOnly count the triples and produce no other output.−D, −−data URIAdd RDF data source URI (not a named graph).If no data sources are given, the query itself mustpoint to the data such as via SPARQL or RDQL FROM uri statements.−d, −−dump−query FORMATPrint the parsed query out in a given FORMAT one of ’debug’, ’structure’ or ’sparql’−f,−−feature NAME(=V ALUE)Set query feature NAME to the VALUE or integer 1 if omitted.The known features can be shownwith-f help or--feature help.−G, −−named URIAdd RDF data source URI (named graph)−h, −−helpShow a summary of the options.−n, −−dryrunPrepare the query but do not execute it.−q, −−quietNo extra information messages.−s, −−source URIAdd RDF data source URI (named graph)URI by adding it to the list of query data source URIs.FORMAT to ’simple’ (default) or ’xml’ (an experimental XML format)−v,−−versionPrint the rasqal library version and exit.−w,−−walk-queryWalk the query and display it using the API.EXAMPLESroqet sparql-query-file.rqRun a SPARQL query contained in the local file sparql-query-file.rq.The data used would be described in FROM statements in the query file.roqet -q -i sparql /sparql-query.rqRun a SPARQL query that is in the web at URI /sparql-query.rq without an extra mes-sages (quiet, -q).roqet -q -i rdql rdql-query-file.rdql /base/Run an RDQL query from a local file rdql-query-file.rdql but using base URI /base/ to resolve any relative URIs.roqet -q -i sparql -r xml /sparql-query.rqRun a SPARQL query that is in the web at URI /sparql-query.rq and format the results in the SPARQL Query Results XML format with no extra messages.roqet -i sparql -e ’SELECT * WHERE { ?s ?p ?o }’ -D stuff.rdfRun a SPARQL query given on the command line against data in the file stuff.rdf. The type of the file will be guessed and likely is of format RDF/XML.CONFORMING TOSPARQL Query Language for RDF,Eric Prud’hommeaux and Andy Seaborne (eds), W3C Recommenda-tion, 15 January 2008./TR/2008/REC-rdf-sparql-query-20080115/SPARQL Query Results XML Format,Jeen Broekstra and Dave Beckett (eds), W3C Recommendation, 15 January 2008./TR/2008/REC-rdf-sparql-XMLres-20080115/RDQL - A Query Language for RDF,Andy Seaborne, W3C Member Submission 9 January 2004 /Submission/2004/SUBM-RDQL-20040109/SEE ALSOlibrasqal(3),rasqal-config(1),libraptor(3)CHANGESAUTHORDave Beckett - /。
Red Hat Enterprise Linux 8 虚拟化配置和管理说明书

Red Hat Enterprise Linux 8配置和管理虚拟化设置您的主机、创建和管理虚拟机并了解 Red Hat Enterprise Linux 8 中的虚拟化功能Last Updated: 2023-08-03Red Hat Enterprise Linux 8 配置和管理虚拟化设置您的主机、创建和管理虚拟机并了解 Red Hat Enterprise Linux 8 中的虚拟化功能法律通告Copyright © 2023 Red Hat, Inc.The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.Linux ® is the registered trademark of Linus Torvalds in the United States and other countries. Java ® is a registered trademark of Oracle and/or its affiliates.XFS ® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.MySQL ® is a registered trademark of MySQL AB in the United States, the European Union and other countries.Node.js ® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.The OpenStack ® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.All other trademarks are the property of their respective owners.摘要要将 Red Hat Enterprise Linux (RHEL)系统用作虚拟化主机,请按照本文档中的说明操作。
Linux操作系统及应用 项目1 安装与基本配置Red Hat Enterprise Linux 8

理解Linux操作系统的体系结构。 掌握如何搭建Red Hat Enterprise Linux 8 服务器 掌握如何登录、退出Linux服务器。
理解Linux的启动过程和运行级别。 掌握如何排除Linux服务器安装的故障。
2
内容导航
1
项目知识准备
2
项目设计与准备
RHEL 8同时对管理员和管理区域进行 了改善的,让系统管理员、Windows管理 员更容易访问。
项目1安装与配置Linux操作系统
11
内容导航
1
项目知识准备
2
项目设计与准备
3
项目实施
4
项目实录:Linux系统安装与基本配置
项目1安装与配置Linux操作系统
12
二、项目设计与准备——项目设计
本项目需要的设备和软件如下: ➢ 1台安装有Windows 10操作系统的计算机,名称为Win10-1,IP地址为192.168.10.31/24。 ➢ RHEL 8的ISO映像文件一套。 ➢ VMware Workstation 15.5 Pro软件一套。 ➢ 本项目借助虚拟机软件要完成如下3项任务: ➢ 安装VMware Workstation。 ➢ 安装RHEL 8第一台虚拟机,名称为Server01。 ➢ 完成对Server01的基本配置。
Linux一般有3个主要部分:内核 (Kernel)、命令解释层(shell或其他操 作环境)、实用工具。
1.内核
内核是系统的心脏,是运行程序和管理 磁盘及打印机等硬件设备的核心程序。操作 环境向用户提供一个操作界面,它从用户那 里接受命令,并且把命令送给内核去执行。 由于内核提供的都是操作系统最基本的功能, 所以如果内核发生问题,那么整个计算机系 统就可能会崩溃。
fedora使用技巧

fedora使用技巧Fedora使用技巧Fedora是一款流行的Linux发行版,它基于Red Hat Enterprise Linux(RHEL)开发而来,提供了一个稳定、安全且功能丰富的操作系统。
本文将为您介绍一些Fedora使用技巧,帮助您更好地利用这个操作系统。
一、使用终端终端是Fedora中非常强大的工具,通过命令行可以完成许多任务。
以下是一些常用的终端命令:1.安装软件包:使用dnf命令可以方便地安装软件包,例如:dnf install package_name。
2.更新系统:使用dnf命令可以更新系统,例如:dnf update。
3.查找文件:使用find命令可以快速查找文件,例如:find / -name file_name。
4.压缩和解压缩文件:使用tar命令可以进行文件的压缩和解压缩,例如:tar -cvf archive.tar file_name。
二、使用软件包管理器Fedora使用dnf作为默认的软件包管理器,它可以方便地管理系统软件包。
以下是一些相关的技巧:1.添加软件源:可以使用dnf命令添加第三方软件源,例如:dnf config-manager --add-repo repo_url。
2.搜索软件包:可以使用dnf命令搜索软件包,例如:dnf search package_name。
3.卸载软件包:可以使用dnf命令卸载软件包,例如:dnf remove package_name。
4.清理系统:可以使用dnf命令清理系统缓存,例如:dnf clean all。
三、使用GNOME桌面环境Fedora默认使用GNOME桌面环境,以下是一些相关的技巧:1.自定义桌面:可以通过系统设置来自定义桌面的外观和行为,例如:更改壁纸、调整面板位置等。
2.使用扩展:可以通过GNOME扩展来增强桌面功能,例如:添加天气插件、任务栏等。
3.使用快捷键:可以通过快捷键来提高工作效率,例如:Ctrl+Alt+T打开终端、Super键打开应用程序菜单等。
fedora8 dhcp

fedora8 dhcpdhcp基于客户/服务器模式。
当dhcp客户端启动时,它会自动与dhcp服务器通信,由dhcp 服务器为dhcp客户端提供自动分配IP地址的服务。
安装了dhcp服务软件的服务器称为dhcp 服务器,而启用了dhcp功能的客户机称为dhcp客户端。
dhcp服务器是以地址租约的方式为dhcp客户端提供服务的,它有以下两种方式。
1.限定租期2.永久租用一、安装[root@localhost etc]# cd /media/Fedora\ 8\ i386\ DVD/Packages/[root@localhost Packages]# find . -name "*dhcp*"./dhcpv6-client-0.10-51.fc8.i386.rpm./libdhcp-1.27-3.fc8.i386.rpm./libdhcp4client-3.0.6-10.fc8.i386.rpm./libdhcp6client-0.10-51.fc8.i386.rpm[root@localhost Packages]# rpm -ivh libdhcp-1.27-3.fc8.i386.rpmwarning: libdhcp-1.27-3.fc8.i386.rpm: Header V3 DSA sigNature: NOKEY, key ID 4f2a6fd2 Preparing... ########################################### [100%]package libdhcp-1.27-3.fc8 is already installed[root@localhost Packages]# rpm -ivh libdhcp4client-3.0.6-10.fc8.i386.rpmwarning: libdhcp4client-3.0.6-10.fc8.i386.rpm: Header V3 DSA sigNature: NOKEY, key ID 4f2a6fd2Preparing... ########################################### [100%]package libdhcp4client-3.0.6-10.fc8 is already installed[root@localhost dhcp]# rpm -ivh dhcp-3.0.6-10.fc8.i386.rpmwarning: dhcp-3.0.6-10.fc8.i386.rpm: Header V3 DSA sigNature: NOKEY, key ID 4f2a6fd2 Preparing... ########################################### [100%] 1:dhcp ########################################### [100%]*********************************************************************dhcp配置文件dhcpd.conf的格式如下:*******************************选项/参数# 这些选项/参数全局有效声明{选项/参数# 这些选项/参数局部有效}*********************************************************************dhcpd.conf文件中常用的声明及功能********************************声明功能shared-network 名称{…} 定义超级作用域subnet 网络号netmask 子网掩码{…} 定义作用域(或IP子网)range 起始IP地址终止IP地址定义作用域(或IP子网)范围host 主机名{…} 定义保留地址group {…} 定义一组参数********************************************************************* dhcpd.conf文件中常用的参数及功能:*******************************参数功能ddns-update-style 类型定义所支持的dns动态更新类型(必选)allow/ignore client-updates 允许/忽略客户机更新dns记录default-lease-time 数字指定默认的租约期限max-lease-time 数字指定最大租约期限hardware 硬件类型MAC地址指定网卡接口类型和MAC地址server-name 主机名通知dhcp客户机服务器的主机名fixed-address IP地址分配给客户端一个固定的IP地址*********************************************************************dhcpd.conf 文件中常用的选项及功能:******************************选项功能subnet-mask 子网掩码为客户端指定子网掩码domain-name “域名”为客户端指定dns域名domain-name-servers IP地址为客户端指定dns服务器的IP地址host-name “主机名”为客户端指定主机名routers IP地址为客户端指定默认网关broadcast-address 广播地址为客户端指定广播地址netbios-name-servers IP地址为客户端指定WINS服务器的IP地址netbios-node-type 节点类型为客户端指定节点类型ntp-server IP地址为客户端指定网络时间服务器的IP地址nis-servers IP地址为客户端指定NIS域服务器的地址nis-domain “名称”为客户端指定所属的NIS域的名称time-offset 偏移差为客户端指定与格林尼治时间的偏移差*********************************************************************二、dhcp配置文件/etc/dhcpd.conf默认是空的# dhcp Server Configuration file.# see /usr/share/doc/dhcp*/dhcpd.conf.sample例子/usr/share/doc/dhcp-3.0.6/dhcpd.conf.sample 从例子拷贝到/etc/dhcpd.conf********************************************************************* dhcpd.conf.sample源文件内容:*****************************[root@localhost dhcp-3.0.6]# more dhcpd.conf.sampleddns-update-style interim;ignore client-updates;subnet 192.168.0.0 netmask 255.255.255.0 {# --- default gatewayoption routers 192.168.0.1;option subnet-mask 255.255.255.0;option nis-domain "";option domain-name "";option domain-name-servers 192.168.1.1;option time-offset -18000; # Eastern Standard Time # option ntp-servers 192.168.1.1;# option netbios-name-servers 192.168.1.1;# --- Selects point-to-point node (default is hybrid). Don't change this unless # -- you understand Netbios very well# option netbios-node-type 2;range dynamic-bootp 192.168.0.128 192.168.0.254;default-lease-time 21600;max-lease-time 43200;# we want the nameserver to appear at a fixed addresshost ns {next-server ;hardware ethernet 12:34:56:78:AB:CD;fixed-address 207.175.42.254;}}三、修改后/etc/dhcpd.conf内容:ddns-update-style interim;ignore client-updates;subnet 192.168.1.0 netmask 255.255.255.0 { 注:修改# --- default gatewayoption routers 192.168.1.1; 注:修改option subnet-mask 255.255.255.0; 注:修改option nis-domain ""; 注:修改option domain-name ""; 注:修改option domain-name-servers 192.168.1.6; 注:修改option time-offset -18000; # Eastern Standard Time # option ntp-servers 192.168.1.1;# option netbios-name-servers 192.168.1.1;# --- Selects point-to-point node (default is hybrid). Don't change this unless # -- you understand Netbios very well# option netbios-node-type 2;range dynamic-bootp 192.168.1.100 192.168.1.110;default-lease-time 21600;max-lease-time 43200;# we want the nameserver to appear at a fixed addresshost ns {next-server ;hardware ethernet 12:34:56:78:AB:CD;fixed-address 207.175.42.254;}}[root@localhost etc]# /etc/rc.d/init.d/dhcpd start启动dhcpd:[确定] 在XP下测试通过四、关闭[root@localhost etc]# /etc/rc.d/init.d/dhcpd stop关闭dhcpd:[确定]。
第2章 Fedora 8基本操作

X Window的特点(续)
(3)弹性设计
因为在X Window系统的设计中,X Server只负责基本的显示及终端的控制, 而其余的部分都是由X Client处理,所以这种设计不受操作系统的限制。 不同的操作系统都可以使用X Server,特别是在UNIX的多任务环境中,更 能发挥其优异的特性。
GNOME的组成
GNOME包括一个面板、一个桌面、一系列有用 的面板程序和主菜单,以及一系列的协议,如图 2-2是一个典型的GNOME界面。
图2-2 GNOME典型界面
面板
面板是能够访问应用程序和菜单的区域, 面板的形式是可以重新配置的,它包含了 有些有用的面板程序和一系列的菜单等。 其中包括应用程序菜单,该菜单包含了各 种应用程序。面板是为放置小程序而设计 的,例如,在面板的最右边是一个小的时 钟程序,它显示系统当前的时间。
X Window的基本概念
一.X Window的组成 (1)X Server(X服务器)与X Client(X 客户端):X Server向 本地计算机上或其它计算机的客户端程序提供服务,这些客户端程 序称为X Client。任何操作系统只要想使用X Window系统,就必须 运行一个X服务器,并在此基础上建立各自的客户端程序,使用X服 务器提供的服务。 X Server主要是控制输出及输入设备的程序,并维护相关资源,它接 收输入设备的信息,并将其传给X Client,而将X Client传来的信息 输出到屏幕上。所以不同的显卡就需要选择不同的X Server,在配 置X Window时最主要的就是配置X Server。 X Window只是一个框架,本身只定义了最基本的窗口功能,如建立 窗口、鼠标控制和键盘输入等,实际上所有显示在X屏幕上的外观及 控制等界面都要由窗口管理器(Windows Manager)来管理。 (2)X Protocol(X协议):X Client与X Server之间的通信使用X protocol。
Fedora系统介绍几及常用指令

Fedora系统介绍几及常用指令一、FC12系统目录结构简介/:系统根目录。
/bin/:系统启动时需要的执行文件所在目录。
/boot/:系统启动目录。
/boot/grub/grub.conf:启动脚本目录文件。
/dev/:设备目录。
/dev/hda1:硬盘设备文件。
/dev/mapper/:LVM设备所在目录。
/dev/null:空设备。
/dev/sda1:usb设备文件。
/dev/ttyS1:串口设备文件。
/etc/:系统配置。
/etc/crontab:定时启动配置文件。
/etc/exports:NFS服务目录配置文件。
/etc/fstab:启动时自动挂载目录配置文件。
/etc/group:用户组信息文件。
/etc/init.d/:系统启动服务软件所在目录。
/etc/inittab:系统启动配置文件。
/etc/mtab:当前挂载目录信息文件(参见mount命令)。
/etc/ntp.conf:NTP服务配置文件/etc/resolv.conf:域名服务器配置文件。
/etc/rc.local:链接文件,链接到/etc/rc.d/rc.local。
/etc/rc.d/rc.local:启动脚本文件。
/etc/samba/f:SAMBA服务配置文件/etc/selinux/config:SELINUX防火墙配置文件。
/etc/sysconfig/i18n:系统字符集文件/etc/sysconfig/network-scripts/ifcfg-ethX:网卡配置文件。
/etc/udev/rules.d/70-persistent-net.rules:网卡配置文件。
/etc/X11/xorg.conf:显示设备及显示格式配置文件。
非必须存在。
/etc/yum.conf:yum服务配置文件。
/figure/:风格自建目录。
对于服务器,通常会分配一个独立的分区;对于虚拟机,建议把它作为一个软链接,链到共享文件夹。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Fedora8常用命令
Linux 的命令(也包括文件名等等)对大小写是敏感的。
模式切换
1、 由字符到图型#startx 或#init 5
2、 由图形到字符#logout 或init 3
3、 注销#logout 或exit 或ctrl+d
4、 关机#poweroff 或init 0或shutdown now 或 halt -p
5、 重启#reboot 或init 6或shutdown -r now
获得帮助
#help 提供内部命令的帮助;#man 或info 提供外部命令的帮助。
ls
最常用的参数有三个: -a -l -F 。
ls: 不显示隐藏文件 ls -a :显示所有文件 ls -l (字母L 的小写)
使用长格式显示文件内容,例如:
1 2 3 4 5 6 7 属性 文件数 拥有者 所属组 大小 日期 文件名
drwx------ 2 Guest users 1024 Nov 21 21:05 Mail
-rwx--x--x 1 root root 89080 Nov 7 22:41 tar*
ls –F
表示在文件的后面多添加表示文件类型的符号,例如*表示可执行,/表示目录,@表示链接文件。
cd
cd [change directory] 进出目录 cd 直接回到根目录(用户) mkdir 、rmdir 、cat
mkdir [make directory]新建目录
rmdir [remove directory] 删除目录 cat >文件名 新建文件 cp
cp [–r] 源文件 目的位置
参数r 是指连同源文件中的子目录一同拷贝。
rm 删除文件(目录)
rm [–i ] 文件名 删除文件(询问)。
rm –r 目录名:连同目录下面的子目录都删除,功能上和rmdir 相似。
rm –f 文件名(目录名):强制删除。
mv 移动文件(目录)
mv 文件名(目录) 新位置
mv 原文件名(目录) 新的文件名(目录)
这个命令的功能是移动目录或文件,引申的功能是给目录或文件重命名。
du ,df 显示磁盘空间
du 显示目前的目录所占的磁盘空间, df 命令可以显示目前磁盘剩余的磁盘空间。
cat 显示(或连接)文件
cat text 显示text 这个文件;
cat file1 file2 依次显示文件的内容; cat file1 file2>file3 把file1,file2的内容结
合起来,再“重定向(>)”到file3文件中。
cat >file1: 新建文件,输入文字,完毕后按
[Ctrl]+[c]结束编辑。
cat file1>>file2:将file1的文件内容“附加”到file2的文件后面,而file2的内容依然存在。
|more,less 分屏显示文件
pwd 显示当前路径(绝对路径)
clear 清屏 su 切换用户
ln 链接文件(快捷方式)
ln 源文件 –s 目标文件。
软链接(不占空间)
ln 源文件 目标文件 硬链接
grep 查找文件
用于查找文件中符合字符串的那行。
find 查找文件
find -name httpd 按照文件名查找文件。
-perm 按照文件权限来查找文件。
-user 按照文件属主来查找文件。
-group 按照文件所属的组来查找文件。
-type 查找某一类型的文件。
* ar
功能说明:建立或修改备存文件,或是从备存
文件中抽取文件。
rpm 打包及安装文具
1.查询rpm 软件包
#rpm -q 软件包名
#rpm -qa //查询安装的所有软件包
#rpm -qa|grep 软件包字符串
2.软件包的安装
#rpm -ivh 软件包
3.文件打包
#tar -cvf [文件名.tar] [文件……目录]
查看包文件的内容
mount,umount 挂载不同的文件系统
1、必须将光盘、U盘等放入驱动器在实施挂载操作
2、不能在挂载目录下实施挂载操作,至少在上一级
3、挂载目录必须事先存在
4、Linux预留挂载目录为/mnt
挂载光盘
#mount [-t iso9660] /dev/cdrom /mnt/cdrom 卸载光盘
#umount /mnt/cdrom或#umount /dev/cdrom 挂载U盘
#mount /dev/sdb1 /mnt/usb
用户和组管理
#useradd 用户名 //创建用户和组
#passwd 用户名 //设置用户密码
#groupadd 组名 //创建组
#usermod –d 路径用户名 //修改用户宿主目录
#usermod –u uid 用户名 //修改用户的UID
#usermod -G 组名用户名 //将用户加入组, 创建私有组#usermod -g 组名用户名 //用户加入组但不创建私有组#gpasswd -d 用户名组名 //将用户从组中删除
#usermod -l 新名原名 //重命名用户
#groupmod -n 新名原名 //重命名组
#userdel 用户名 //删除用户
#groupdel 组名 //删除组
#passwd -d 用户名 //删除用户密码
ps 进程及服务管理
ps -aux //查看所有进程(静态)
top //查看动态变化的进程
pstree //查看进程树
kill -9 PID 或#killall -9 进程名删除进程
#chkconfig --list //查看所有服务的启动状态
网卡设置
1、设置ip地址(即时生效,重启失效)
#ifconfig eth0 ip地址 netmask 子网掩码
2、配置文件设置ip地址(重启生效,永久生效)#vi /etc/sysconfig/network-scripts/ifcfg-eth0
3、重启网络服务
#service network restart //重启所有网卡
4、禁用网卡,启动网卡
#ifdown eth0
#ifup eth0
5、屏蔽网卡,显示网卡
#ifconfig eth0 down
#ifconfig eth0 up
6、配置DNS客户端(最多三个)
#vi /etc/resolv.conf
nameserver 202.99.96.68
7、更改主机名(即时生效)
#hostname 主机名
8、更改主机名(重启计算机生效,永久生效)#vi /etc/sysconfig/network
HOSTNAME=主机名
alias 设置别名
alias [-p] [name[=value] ...]
例:alias ll="ls -l"
alias confighttp="vi /etc/httpd/conf/httpd.conf"
cron 计划任务
1、开启服务:service crond restart
2、编辑任务:crontab –e
0 6 * * * echo “Good morning!” >>/tmp/text.txt
每天早上6点显示“Good morning!”并保存在/tmp/text.txt 0 4 * * 0 /sbin/poweroff (shutdown –h now)
每周日凌晨4点关闭服务器(reboot /shutdown –r 重启)。
3、取消所有任务:crontab –r
附:上海星光2009年部分Linux试题答案
(2)00 00 1 * * root shutdown -h now FOR MAINTANCE!
(3)alias confighttp="vi httpd"
(4)find /etc -name "passwd" |xargs grep "test" >> /tmp/
(5)使用mail命令或者telnet 都可以进行邮件的发送切换到test用户使用mail命令就可以显示邮件列表(7)find /etc -name "http*" >>/tmp/fhttp.file ####http开头find /etc -iname "shell*" -exec basename {} \; >> /tmp/ishell.file ####文件名不包含父目录
find . -iname "shell*"|xargs grep -is "shell" >>/tmp/ishell.files ###匹配的行信息
(8)tar -zcvf var.tar.gz var
(9)rpm qa >>/tmp/rpm.all
(10)ps aux >>/tmp/process.all
top >> /tmp/serinfo Ctrl+c。