linux常用命令使用集锦

【声明】声明本文部分材料来源网络,如有疑问请联系。

linux常用网址收集

linux资源

FNV算法

libstdc++ file list

glib源码目录

Linux Documentation Project Guides

grymoire

syslog-ng-doc

https://www.sourceware.org/autobook/

https://www.dotdeb.org/instructions/

https://launchpad.net/

系统配置

查看ubuntu的版本号

cat /etc/issue

linux下修改时间为上海时间[东8区]

mv  /etc/localtime /etc/localtime.bak
cp  /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

Ubuntu中用命令校正系统时间

sudo ntpdate 210.72.145.44

Linux socket接收缓冲区大小的配置:

/proc/sys/net/core/rmem_default
/proc/sys/net/core/rmem_max
/proc/net/udp, which is reporting used rcv buffer sizes, though.
/proc/net/dev 维护网卡数据接收情况

sysctl 设置linux系统参数

sysctl –a; 查询系统所有参数的配置
sysctl –w net.ipv4.tcp_max_syn_backlog=32000;设置同时可以连接的tcp套接字数
sysctl fs.file-max;查看系统范围内能打开的文件描述符数
如果在系统启动的时候,希望设置,需要在文件:/etc/sysctl.conf中配置。

Linux /etc/fstab文件的说明

这个文件是一个系统配置文件,主要记录了一些挂在文件的信息。当linux系统启动的时候,会读取这个文件,自动挂载。
如果在linux终端下面执行 cat /etc/fstab ,会显示这个文件的格式,如下:

<file system>  <mount point>   <type>  <options>       <dump>  <pass>

一共有6个配置项,我们分别进行说明:

我们以挂载命令:mount -t nfs 192.168.40.211:/test/drbd/conf /test/etc_tms 进行说明。

<file system> : 需要挂在的设备文件,或者普通文件。比如 /dev/hda1 或者上面的192.168.40.211:/test/drbd/conf

<mount point>: 要选择的挂载点。

<type>:文件系统的类型,linux支持的文件系统类型有:adfs、befs、cifs、ext3、 ext2、ext、iso9660、kafs、minix、msdos、vfat、umsdos、proc、reiserfs、swap、 squashfs、nfs、hpfs、ncpfs、ntfs、affs、ufs。

<options>:设置选项,各个选项用逗号隔开。如下:

auto: 系统自动挂载,fstab默认就是这个选项

defaults: rw, suid, dev, exec, auto, nouser, and async.

noauto 开机不自动挂载

nouser 只有超级用户可以挂载

ro 按只读权限挂载

rw 按可读可写权限挂载

user 任何用户都可以挂载

请注意光驱和软驱只有在装有介质时才可以进行挂载,因此它是noauto

<dump>:一般填0

<pass>:一般填0
###在linux平台下,设置core dump文件生成的方法

1) 在终端中输入ulimit -c 如果结果为0,说明当程序崩溃时,系统并不能生成core dump。

2) 使用ulimit -c unlimited命令,开启core dump功能,并且不限制生成core dump文件的大小。

如果需要限制,加数字限制即可。ulimit - c 1024

3) 默认情况下,core dump生成的文件名为core,而且就在程序当前目录下。新的core会覆盖已存在的core。

通过修改/proc/sys/kernel /core_uses_pid文件,可以将进程的pid作为作为扩展名,

生成的core文件格式为core.xxx,其中xxx即为pid

4) 通过修改/proc/sys/kernel/core_pattern可以控制core文件保存位置和文件格式。例如:
将所有的core文件生成到/corefile目录下,文件名的格式为core-命令名-pid-时间戳

echo "/corefile/core-%e-%p-%t" > /proc/sys/kernel/core_pattern

修改Linux下最大open files 数

issue:

How do I set the maximum number of files allowed to be open on a system 

Resolution:

The current setting for maximum number of open files can be viewed with the command: 
    ulimit -n 

This number indicates the maximum number of files normal users (i.e. non-root) can have open in a single session.
Note that for the root user, ulimit -n will sometimes output 1024 even after following the procedure to increase the maximum number of open files.
This won’t effect root’s ability to open large numbers of files, as only normal users are bound by this value.

To increase the maximum number of open files beyond the default of 1024, two changes to the system may be necessary.
In these examples, we will increase the maximum number of open files to the arbitrary value of 2048.
All changes need to be made by the root user and users will need to log out and log back in before the changes will take effect.

  1. Configure the system to accept the desired value for maximum number of open files Check the value in /proc/sys/fs/file-max to see if it is larger than the value needed for the maximum number of open files:

    # cat /proc/sys/fs/file-max

If the value isn’t large enough, echo an appropriate number into the variable and add the change to /etc/sysctl.conf to make it persistent across reboots. If t

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值