linux命令集锦1
来源:互联网 发布:定制软件多少钱 编辑:程序博客网 时间:2024/05/27 14:13
[gxlinux@localhost ~]$ pwd #显示当前文件目录 /home/gxlinux
[gxlinux@localhost ~]$ date #显示当前时间
2008年 01月 20日 星期日 23:45:27 CST
[gxlinux@localhost ~]$ df -h #显示硬盘信息
文件系统 容量 已用 可用 已用% 挂载点
/dev/hda6 9.8G 2.6G 6.7G 28% /
/dev/hda5 35G 11G 24G 30% /media/windowsD
tmpfs 378M 0 378M 0% /dev/shm
/dev/hda7 9.5G 173M 8.8G 2% /home
[root@localhost gxlinux]# /sbin/fdisk -l #详细显示硬盘信息
Disk /dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 2611 20972826 7 HPFS/NTFS
/dev/hda2 2612 9729 57175335 f W95 Ext'd (LBA)
/dev/hda5 2612 7073 35840983+ b W95 FAT32
/dev/hda6 7074 8387 10554673+ 83 Linux
/dev/hda7 8388 9661 10233373+ 83 Linux
/dev/hda8 9662 9729 546178+ 82 Linux swap / Solaris
[gxlinux@localhost ~]$ du -h 11.jpg #查看文件大小
132K 11.jpg
[gxlinux@localhost ~]$ uname -a #查看系统信息
Linux localhost.localdomain 2.6.18-1.2798.fc6 #1 SMP Mon Oct 16 14:37:32 EDT 2006 i686 i686 i386 GNU/Linux
[gxlinux@localhost ~]$ man ls #查看ls的帮助文件,下同
[gxlinux@localhost ~]$ ls –help
[gxlinux@localhost ~]$ mkdir new #创建文件夹
[gxlinux@localhost ~]$ rm -r new #删除文件夹
[gxlinux@localhost ~]$ touch new #创建新文件
[gxlinux@localhost ~]$ rm -i new #提示删除文件
rm:是否删除 一般空文件 “new”? Y
[gxlinux@localhost ~]$ ls #查看当前目录下的文件及文件夹
11.jpg Desktop stadick 命令.odt 挂载.odt
[gxlinux@localhost ~]$ ls -a #查看目录下全部文件及文件夹
. Desktop .gtkrc-1.2-gnome2 .redhat
.. .dmrc .ICEauthority .scim
11.jpg .eggcups .lesshst stadick
.adobe .esd_auth .macromedia .thumbnails
.bash_history .gconf .metacity .Trash
.bash_logout .gconfd .mozilla .wapi
.bash_profile .gnome .nautilus .wine
.bashrc .gnome2 .openoffice.org2.0 .xsession-errors
.beagle .gnome2_private .purple 命令.odt
.chewing .gstreamer-0.10 .recently-used 挂载.odt
.config .gtk-bookmarks .recently-used.xbel
[gxlinux@localhost ~]$ ls -l #查看文件权限
总计 176
-rw-r--r-- 1 gxlinux gxlinux 126927 01-20 23:43 11.jpg
drwxr-xr-x 2 gxlinux gxlinux 4096 01-20 22:09 Desktop
drwxr-xr-x 2 gxlinux gxlinux 4096 01-20 22:37 stadick
-rw------- 1 gxlinux gxlinux 8143 01-20 23:50 命令.odt
-rw-r--r-- 1 gxlinux gxlinux 9433 01-20 23:49 挂载.odt
[gxlinux@localhost ~]$ ls -1 #分行查看
11.jpg
Desktop
stadick
命令.odt
挂载.odt
[gxlinux@localhost ~]$ clear #清空屏幕
[gxlinux@localhost ~]$ cp 11.jpg stadick #将文件复制到目录下
[gxlinux@localhost ~]$ ls stadick
11.jpg
[gxlinux@localhost ~]$ mv 11.jpg 22.jpg #将文件改名
[gxlinux@localhost ~]$ ls
22.jpg Desktop stadick 命令.odt 挂载.odt
[gxlinux@localhost ~]$ mv 22.jpg stadick #移动文件到目录下
[gxlinux@localhost ~]$ ls
Desktop stadick 命令.odt 挂载.odt
[gxlinux@localhost ~]$ ls stadick
11.jpg 22.jpg
[gxlinux@localhost ~]$ cat>new.txt #创建文件,输入完毕回车,CTRL+D退出
gxlinux
[gxlinux@localhost ~]$ cat new.txt #查看文件内容
gxlinux
[gxlinux@localhost ~]$ cat new.txt>new2.txt #新建文件,将前一个文件内容写入新文件中
[gxlinux@localhost ~]$ cat new2.txt
gxlinux
[gxlinux@localhost ~]$ cat new.txt>>new2.txt #将前一个文件内容附加到后一个文件当中
[gxlinux@localhost ~]$ cat new2.txt
gxlinux
gxlinux
[gxlinux@localhost ~]$ cat new2.txt -n #分行查看
1 gxlinux
2 gxlinux
[gxlinux@localhost ~]$ w #查看当前在线用户,下同
^[[3~ 00:04:59 up 34 min, 2 users, load average: 0.02, 0.11, 0.26
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
gxlinux pts/1 :0.0 23:44 0.00s 0.18s 0.02s w
gxlinux pts/2 :0.0 23:46 17.00s 0.19s 0.19s bash
[gxlinux@localhost ~]$ who
gxlinux pts/1 2008-01-20 23:44 (:0.0)
gxlinux pts/2 2008-01-20 23:46 (:0.0)
[gxlinux@localhost ~]$ finger
Login Name Tty Idle Login Time Office Office Phone
gxlinux gxlinux pts/1 Jan 20 23:44 (:0.0)
gxlinux gxlinux pts/2 Jan 20 23:46 (:0.0)
[gxlinux@localhost ~]$ ls -l new.txt #查看该文件的权限
-rwxrw---- 1 root gxlinux 8 01-20 23:59 new.txt
[gxlinux@localhost ~]$ chmod u-x,g-w,o+r new.txt #改变权限(仔细查看一下变化)
chmod: 更改 “new.txt” 的权限: 不允许的操作
[gxlinux@localhost ~]$ su #切换用户到root
口令:
[root@localhost gxlinux]# chmod u-x,g-w,o+r new.txt #u用户g组员o其它
[root@localhost gxlinux]# ls -l new.txt
-rw-r--r-- 1 root gxlinux 8 01-20 23:59 new.txt
[root@localhost gxlinux]# chown gxlinux new.txt #改变所有者
[root@localhost gxlinux]# ls -l new.txt
-rw-r--r-- 1 gxlinux gxlinux 8 01-20 23:59 new.txt
[root@localhost gxlinux]# su gxlinux
[gxlinux@localhost ~]$
[gxlinux@localhost ~]$ cal 9 1752 #查看某年某月
九月 1752
日 一 二 三 四 五 六
1 2 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
[gxlinux@localhost ~]$ sleep 10;echo "Hello" #休息10秒,然后输出文字;单行多条命令
Hello
[gxlinux@localhost ~]$ cat > old.txt
Gxlinux linux
linus you
[gxlinux@localhost ~]$ wc old.txt #查看 行数/单词数/字符数
2 4 24 old.txt
[gxlinux@localhost ~]$ bc #一个简单计算器
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
3+4-2
5
3*4/2
6
quit
- linux命令集锦1
- Linux 命令集锦
- linux 各种命令集锦
- Linux Shell命令集锦
- Linux Shell命令集锦
- Linux命令集锦
- linux 命令集锦
- linux 命令集锦
- Linux 命令集锦
- Linux 命令集锦
- linux 系统命令集锦
- Linux 相关命令集锦
- 实用Linux命令集锦
- Linux 命令集锦
- linux服务器命令集锦
- Linux 命令 集锦
- Linux文本命令集锦
- Linux命令集锦
- Linux 线程实现机制分析
- 招投标暗箱操作面纱:回扣为王
- 使用 Rico JavaScript 库、ColdFusion MX 7 和 Windows Indexing Service 构建一个启用 Ajax 的搜索页面
- 斯大林身世之谜曝光:父亲在酒后斗殴中被捅死
- 什么是散列表(哈希表)
- linux命令集锦1
- “生命游戏”的多线程算法思考
- VC常用技巧总结
- 脚本实现vi/cp/mv前自动备份源文件
- 自己写的.net分页控件,测试没有问题!
- WebSphere 应用服务器 6.1 Web Services 功能部件包入门
- 蒙牛内幕连载
- 观察者模式
- 告别“前门大街”(图文)