山东大学linux实验4.docx
《山东大学linux实验4.docx》由会员分享,可在线阅读,更多相关《山东大学linux实验4.docx(16页珍藏版)》请在冰豆网上搜索。
山东大学linux实验4
1da
dashdate
2m
Displayall130possibilities?
(yorn)
输入n又显示m
3administrator@ubuntu:
~$mk
mkdirmkfs.bfsmkfs.ntfsmk_modmap
mkdiskimagemkfs.cramfsmkfs.vfatmknod
mkdosfsmkfs.ext2mkhomedir_helpermkntfs
mke2fsmkfs.ext3mkinitramfsmkpasswd
mkfifomkfs.ext4mkinitramfs-kpkgmkswap
mkfontdirmkfs.ext4devmkisofsmktap
mkfontscalemkfs.minixmklost+foundmktemp
mkfsmkfs.msdosmkmanifestmkzftree
4由命令列表知只需再输入字母d即可,其余用tab键补全。
但只输入mkd仍有多余命令,只有全部输入后才满足条件。
5administrator@ubuntu:
~$mkdirnewdir
6administra后,中止tor@ubuntu:
~$lsnewdir/
可以使用文件补全功能来实现。
7administrator@ubuntu:
~$alias
aliasalert='notify-send--urgency=low-i"$([$?
=0]&&echoterminal||echoerror)""$(history|tail-n1|sed-e'\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
aliasegrep='egrep--color=auto'
aliasfgrep='fgrep--color=auto'
aliasgrep='grep--color=auto'
aliasl='ls-CF'
aliasla='ls-A'
aliasll='ls-alF'
aliasls='ls--color=auto'
8#aliasls=‘ls-l’。
9#aliasls
10administrator@ubuntu:
~$ls
总用量68
-rw-r--r--1administratoradministrator1792011-11-0520:
14examples.desktop
drwxr-xr-x2administratoradministrator40962011-11-1908:
23newdir
drwxr-xr-x2administratoradministrator40962011-11-1220:
58thisisatest
drwxr-xr-x3administratoradministrator40962011-11-1220:
58userfile
drwxr-xr-x2administratoradministrator40962011-11-1221:
00userfile-hard
drwxr-xr-x2administratoradministrator40962011-11-1221:
01userfile-soft
-rw-r--r--1administratoradministrator15512011-11-1220:
54usersfile
-rw-r--r--1administratoradministrator71992011-11-1820:
30vitest
drwxr-xr-x2administratoradministrator40962011-11-0520:
19公共的
drwxr-xr-x2administratoradministrator40962011-11-0520:
19模板
drwxr-xr-x2administratoradministrator40962011-11-0520:
19视频
drwxr-xr-x2administratoradministrator40962011-11-0520:
19图片
drwxr-xr-x2administratoradministrator40962011-11-0520:
19文档
drwxr-xr-x2administratoradministrator40962011-11-0520:
19下载
drwxr-xr-x2administratoradministrator40962011-11-0520:
19音乐
drwxr-xr-x5administratoradministrator40962011-11-1907:
59桌面
11#\ls
examples.desktopuserfileusersfile模板文档桌面
newdiruserfile-hardvitest视频下载
thisisatestuserfile-soft公共的图片音乐
12#unaliasls
13#aliasls
14examples.desktopuserfileusersfile模板文档桌面
newdiruserfile-hardvitest视频下载
thisisatestuserfile-soft公共的图片音乐
15#aliascde=‘cd/etc‘
16ls/bin/*sh
/bin/bash/bin/dash/bin/rbash/bin/sh/bin/static-sh
系统中有bashell,dashell,rbashell,shell,staticshell。
作用:
列出在bin目录下的所有以sh结尾的文件。
17cd/etc
administrator@ubuntu:
/etc$ls
acpigroup-passwd-
adduser.confgrub.dpcmcia
alternativesgshadowperl
anacrontabgshadow-pm
apmgtk-2.0pnm2ppa.conf
apparmorhdparm.confpolkit-1
apparmor.dhost.confpopularity-contest.conf
apporthostnameppp
apthostsprofile
at.denyhosts.allowprofile.d
avahihosts.denyprotocols
bash.bashrchppulse
bash_completionifplugdpython
bash_completion.dinitpython2.7
bindresvport.blacklistinit.drc0.d
blkid.confinitramfs-toolsrc1.d
blkid.tabinputrcrc2.d
bluetoothinsservrc3.d
bogofilter.cfinsserv.confrc4.d
bonobo-activationinsserv.conf.drc5.d
brlapi.keyiproute2rc6.d
brlttyissuerc.local
ca-certificatesrcS.d
ca-certificates.confkbdresolvconf
calendarkernelresolv.conf
chatscriptskernel-img.confrmt
checkbox.dkerneloops.confrpc
compizconfigldaprsyslog.conf
computer-janitor.dld.so.cachersyslog.d
ConsoleKitld.so.confsamba
console-setupld.so.conf.dsane.d
cron.dlegalsecuretty
cron.dailylftp.confsecurity
cron.hourlylibpaper.dsensors3.conf
cron.monthlylibreofficesensors.d
crontablintianrcservices
cron.weeklylocale.aliassgml
crypttablocaltimeshadow
cupslogcheckshadow-
cupshelperslogin.defsshells
dbus-1logrotate.confskel
debconf.conflogrotate.dsnmp
debian_versionlsb-basesound
defaultlsb-base-logging.shspeech-dispatcher
defomalsb-releasessh
deluser.confltrace.confssl
depmod.dmagicsudoers
dhcpmagic.mimesudoers.d
dhcp3mailcapsysctl.conf
dictionaries-commonmailcap.ordersysctl.d
doc-basemanpath.configterminfo
dpkgmime.typestimezone
emacsmke2fs.confucf.conf
environmentmodprobe.dudev
firefoxmodulesufw
fontsmonoupdatedb.conf
foomaticmotdupdate-manager
fstabmtabupdate-motd.d
fuse.confmtab.fuselockupdate-notifier
gai.confmtools.confUPower
gaminnanorcusb_modeswitch.conf
gconfnetscsid.confusb_modeswitch.d
gdbnetworkvim
gdmNetworkManagervtrgb
ghostscriptnetworkswgetrc
ginnnewtwodim.conf
gnomensswitch.confwpa_supplicant
gnome-app-installobex-data-serverX11
gnome-settings-daemonopenofficexdg
gnome-system-toolsoptxml
gnome-vfs-2.0pam.confxul-ext
gnome-vfs-mime-magicpam.dzsh_command_not_found
groffpapersize
grouppasswd
18
(1)ls*conf
adduser.confkerneloops.confpopularity-contest.conf
blkid.confld.so.confresolv.conf
ca-certificates.conflftp.confrsyslog.conf
debconf.conflogrotate.confsensors3.conf
deluser.confltrace.confsysctl.conf
fuse.confmke2fs.confucf.conf
gai.confmtools.confupdatedb.conf
hdparm.confnetscsid.confusb_modeswitch.conf
host.confnsswitch.confwodim.conf
insserv.confpam.conf
kernel-img.confpnm2ppa.conf
gconf:
2gconf.xml.defaultsgconf.xml.mandatorygconf.xml.system
resolvconf:
(2)ls[dD]*
debconf.confdebian_versiondeluser.conf
dbus-1:
event.dsession.confsession.dsystem.confsystem.d
default:
acpidbrlttygrubnsssaned
acpi-supportconsole-setuphaltntpdatespeech-dispatcher
alsacronirqbalancepulseaudiotmpfs
apportcupskerneloopsrcSufw
avahi-daemondbuskeyboardrsyncuseradd
bootlogddevptslocalersyslog
defoma:
configfontconfig.subst-ruleloc-cset.dataxenc-cset.data
csetenc-xenc.data2hintsps-cset-enc.data
depmod.d:
ubuntu.conf
dhcp:
dhclient.confdhclient-enter-hooks.ddhclient-exit-hooks.d
dhcp3:
dhclient-enter-hooks.d
dictionaries-common:
words
doc-base:
documents
dpkg:
dpkg.cfgdpkg.cfg.doriginsshlibs.defaultshlibs.override
(3)ls?
?
?
?
o*
debconf.confld.so.confnetworksrc.localshadow
ld.so.cachelogrotate.confprotocolssensors3.confshadow-
ConsoleKit:
run-seat.drun-session.dseats.d
console-setup:
cached.kmap.gzcompose.ISO-8859-13.inccompose.ISO-8859-8.inc
compose.ARMSCII-8.inccompose.ISO-8859-14.inccompose.ISO-8859-9.inc
compose.CP1251.inccompose.ISO-8859-15.inccompose.KOI8-R.inc
compose.CP1255.inccompose.ISO-8859-16.inccompose.KOI8-U.inc
compose.CP1256.inccompose.ISO-8859-1.inccompose.TIS-620.inc
compose.GEORGIAN-ACADEMY.inccompose.ISO-8859-2.inccompose.VISCII.inc
compose.GEORGIAN-PS.inccompose.ISO-8859-3.incremap.inc
compose.IBM1133.inccompose.ISO-8859-4.incUni2-Fixed16.psf
compose.ISIRI-3342.inccompose.ISO-8859-5.incvtrgb
compose.ISO-8859-10.inccompose.ISO-8859-6.incvtrgb.vga
compose.ISO-8859-11.inccompose.ISO-8859-7.inc
depmod.d:
ubuntu.conf
ld.so.conf.d:
GL.confi686-linux-gnu.conflibasound2.conflibc.conf
logrotate.d:
apportcupspm-utilsspeech-dispatcher
aptdpkgpppufw
consolekitjockey-commonrsyslogunattended-upgrades
network:
if-down.dif-post-down.dif-pre-up.dif-up.dinterfaces
NetworkManager:
dispatcher.dNetworkManager.confsystem-connectionsVPN
openoffice:
README.dictionary.lst
python:
debian_config
python2.7:
sitecustomize.py
sensors.d:
(4)ls*[tT][aA][bB]*
(5)ls*[0-9]
dbus-1:
event.dsession.confsession.dsystem.confsystem.d
dhcp3:
dhclient-enter-hooks.d
gnome-vfs-2.0:
modules
gtk-2.0:
im-multipress.conf
iproute2:
ematch_maprt_dsfieldrt_protosrt_realmsrt_scopesrt_tables
polkit-1:
localauthoritylocalauthority.conf.dnullbackend.conf.d
python2.7:
sitecustomize.py
X11:
app-defaultsfontsxinitXreset.dXsession.d
cursorsrgb.txtxkbXresourcesXsession.options
default-display-managerXXresetXsessionXwrapper.config
(6)ls*[!
0-9]
19ls-d?
[!
y]*[e-f]
adduser.confkernel-img.confpam.conf
blkid.confkerneloops.confpapersize
bogofilter.cfld.so.cachepnm2ppa.conf
ca-certificates.confld.so.confpopularity-contest.conf
debconf.conflftp.confprofile
deluser.conflibreofficepulse
doc-baselocaltimeresolvconf
fuse.conflogrotate.confresolv.conf
gai.conflsb-basersyslog.conf
gconflsb-releasesensors3.conf
gnomeltrace.conftimezone
groffmagic.mimeucf.conf
hdparm.confmke2fs.confupdatedb.conf
host.confmtools.confusb_modeswitch.conf
hostnamenetscsid.confwodim.conf
insserv.confnsswitch.conf
issueopenoffice
最短例如会是abce
20:
/etc$cd
:
~$
21
(1)stu@stu-Lenovo:
~$cat>junk
kdslaaaadsaeiwa
faltjiaothegdsvgdfs
faksldutgjiresfhdse
geothgushbvsd
^C
stu@stu-Lenovo:
~$catjunk
kdslaaaadsaeiwa
faltjiaothegdsvgdfs
faksldutgjiresfhdse
geothgushbvsd
stu@stu-Lenovo:
~$cat>>junk
fjietukdjkjvgdk
gjfdkgjreiuygdsa
hfdwrtweaugei
fds
^C
stu@stu-Lenovo:
~$catjunk
dsaklfweioturiogjdsfkfj
dfhstreywior]
hdfsklthuierwioehfs
dshaoiuyhd
fjietukdjkjvgdk
gjfdkgjreiuygdsa
hfdwrtweaugei
fds
22
(1)administrator@ubuntu:
~$catjunkjunk2>cat.out2>cat.err
(2)administrator@ubuntu:
~$cat.junkjunk2>cat.out2>/dev/null
23ls|wc-l19
24dministrator@ubuntu:
~$ls-l>tempfile
administrator@ubuntu:
~$wc-ltempfile
21tempfile
administrator@ubuntu:
~$rmtempfile
不一样,此处为对文件tempfile的处理,而7题是定义或显示别名的,在标准输出上打印别名列表。
二者是有区别的。
25administrator@ubuntu:
~$ls>tempfile2
administrator@ubuntu:
~$wc-ltempfile2
20tempfile2
26date;who;>file
2011年11月19日星期六14:
31:
51CST
administratortty72011-11-1913:
35(:
0)
administratorpts/02011-11-1914:
04(:
0.0)
27administrator@ubuntu:
~$set
administrator@ubuntu:
~$env
28administrator@ubuntu:
~$localvar=10
administrator@ubuntu:
~$echo$localvar
10
administrator@ubuntu:
~$set
29administrator@ubuntu:
~$$bash
administrator@ubuntu:
~$echo$localvar
因为变量是本地变量,只在其父进程中有效。
30exportlocalvar命令可以将值带