记下常用的LINUX,UNIX系统中用到的几个命令

本文介绍了如何在Linux系统中查看各种基本信息,包括系统版本、内存大小、硬盘容量、CPU详情等,并提供了常用命令及其使用方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >



1、查看linux的具体版本情况

   (1)查Linux内核:
[oracle@linux ~]$ uname   -a
Linux linux 2.6.9-42.ELsmp #1 SMP Wed Jul 12 23:27:17 EDT 2006 i686 i686 i386 GNU/Linux
    (2)查linux内核:
[oracle@linux ~]$ uname  - r
2.6.9-42.ELsmp
     (3)查linux内核详细信息:
[oracle@linux ~]$ cat   /proc/version
Linux version 2.6.9-42.ELsmp (bhcompile@hs20-bc1-1.build.redhat.com) (gcc version 3.4.6 20060404 (Red Hat 3.4.6-2)) #1 SMP Wed Jul 12 23:27:17 EDT 2006
     (4)查linux所发行的版本:
[oracle@linux ~]$ cat /etc/issue
Red Hat Enterprise Linux AS release 4 (Nahant Update 4)
Kernel \r on an \m
    (5)查linux所发行的版本:(如果是redhat,可以查看/etc/redhat-release)
[oracle@linux ~]$ cat /etc/redhat-release
Red Hat Enterprise Linux AS release 4 (Nahant Update 4)


2、查看内存大小:
[oracle@linux ~]$ free
             total       used       free     shared    buffers     cached
Mem:       4145144    3172260     972884          0      39696    2653688
-/+ buffers/cache:     478876    3666268
Swap:      2162680      39760    2122920

或者用top命令查看:
[oracle@linux ~]$top

如果用的是AIX系统,可以同topas命令查看相关的cpu、磁盘IO、内存、交换空间等情况


3、查看硬盘大小:
[oracle@linux ~]$ df    -lh      (df   -g    (GB)   ,df   -m (MB))
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      266G  204G   50G  81% /
/dev/sda1              99M   13M   82M  14% /boot
none                  2.0G     0  2.0G   0% /dev/shm

4、用root用户查看系统的分区情况:
[root@linux ~]# fdisk    -l

Disk /dev/sda: 292.3 GB, 292326211584 bytes
255 heads, 63 sectors/track, 35539 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14       35539   285362595   8e  Linux LVM

5 、查看cpu详细信息:
[oracle@linux ~]$ cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 15
model           : 6
model name      : Intel(R) Xeon(TM) CPU 3.00GHz
stepping        : 8
cpu MHz         : 2993.039
cache size      : 4096 KB
physical id     : 2
siblings        : 4
core id         : 4
cpu cores       : 2
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 6
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm pni monitor ds_cpl cid xtpr
bogomips        : 5989.86

有8个cpu,会有8个cpu的信息。

可以看出一共由8个cpu组成。

或者:

[oracle@linux processor]$ pwd
/proc/acpi/processor
[oracle@linux processor]$ ls
CPU0  CPU1  CPU2  CPU3  CPU4  CPU5  CPU6  CPU7

到/proc/acpi/processor/目录下看看有几个CPU文件夹即可。如果只有一个,则只有CPU0文件夹

6、查当前的用户:
[oracle@linux ~]$ whoami   (linux,unix通用)
oracle

7、查系统中的所有用户: (linux,unix通用)
[oracle@linux ~]$ who
oracle   pts/1        Jul 21 11:36 (10.69.182.101)
oracle   pts/2        Jul 21 11:37 (linux)

下面的命令在配置网络ip的时候频繁用到

8、查看IP地址:ifconfig

9、配置ip命令:netconfig

10、使ip生效:service network restart

11、启动ftp服务:service vsftpd restart

12、启动telnet服务

用vi编辑该文件/etc/xinetd.d/telnet文件

chkconfig    telnet    on  //该命令修改了/etc/xinetd.d/telnet的配置,设置disable=no

service xinetd restart

chkconfig –list
13、查看telnet 启动状态

14、关闭linux的防火墙:service    iptables    stop

15、 删除非空目录
     rm     -fr  目录名(谨慎使用)
16、   查看所有系统的进程
     用netstat   -an   (或ps  如:查oracle的进程命令    ps   -ef|grep   ora_)
17、    linux加载windows fat32的硬盘
     mount -t vfat /dev/sda7 /mnt/fat32
18    查主机名称:
     hostname



 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/12778571/viewspace-580388/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/12778571/viewspace-580388/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值