Linux常用命令汇总

df 查看存储状态

top 查看内存和CPU状态

last 查看历史登陆,可以看看服务器有没有陌生IP登陆

例:last|grep 192.168.1.1  查看192.168.1.1的登陆情况 

dmesg:查看核心启动日志

free:显示内存使用情况

uname -a :显示系统信息

 

tail 查看文件尾

例:tail -100f game.log 查看文件最后100行,持续刷新,适合在服务器上看实时日志时使用


查看指定端口是哪个服务在使用:

sudo fuser -v 9000/tcp

 

Linux杂记

此帖子用于记录使用Linux过程中遇到的各种小问题。


1、使用ln命令跨分区链接目录时,报错“目录链接出错”。

答:2.4 kernel以上,可以用mount –bind命令来链接。

 The bind mounts.
              Since Linux 2.4.0 it is possible to remount  part  of  the  file
              hierarchy somewhere else. The call is
                     mount --bind olddir newdir
              or shortoption
                     mount -B olddir newdir
              or fstab entry is:
                     /olddir /newdir none bind

              After  this  call the same contents is accessible in two places.
              One can also remount a single file (on a single file). It's also
              possible  to  use  the  bind mount to create a mountpoint from a
              regular directory, for example:

                     mount --bind foo foo

              The bind mount call attaches only (part of) a single filesystem,
              not possible submounts. The entire file hierarchy including sub‐
              mounts is attached a second place using

                     mount --rbind olddir newdir

              or shortoption
                     mount -R olddir newdir

              Note that the filesystem mount options will remain the  same  as
              those  on  the  original  mount  point, and cannot be changed by
              passing the -o  option  along  with  --bind/--rbind.  The  mount
              options  can be changed by a separate remount command, for exam‐
              ple:

                     mount --bind olddir newdir
                     mount -o remount,ro newdir

              Note that behavior of  the  remount  operation  depends  on  the
              /etc/mtab  file. The first command stores the 'bind' flag to the
              /etc/mtab file and the second command reads the  flag  from  the
              file.  If you have a system without the /etc/mtab file or if you
              explicitly define source and  target  for  the  remount  command
              (then  mount(8)  does  not read /etc/mtab), then you have to use
              bind flag (or option) for the remount command too. For example:

                     mount --bind olddir newdir
                     mount -o remount,ro,bind olddir newdir

继续阅读Linux杂记

在Linux下如何打开bitlocker加密的硬盘

我们这里用到一款叫做dislocker的工具,它可以在Linux或者Mac OSX中,读写被Windows Bitlocker加密的卷。它的GitHub地址:https://github.com/Aorimn/dislocker

以下是我的操作步骤:

1、创建两个文件夹,用来挂载被解锁的文件块和硬盘上的文件,我这里分别在/media目录下创建了windows文件夹和mount文件夹,打开终端(Ctrl+Alt+T),输入下面的命令:

$sudo mkdir /media/windows
$sudo mkdir /media/mount/

继续阅读在Linux下如何打开bitlocker加密的硬盘

Windows 7怎样卸载补丁包

  安装Windows 更新无疑是我们更新Windows系统的主要途径之一。尽管它们经过测试都很稳定,但每位用户的软件环境不尽相同,并不是所有的更新都能如我们预期的那样运行良好。如果安装某个更新后,某个程序无法正常工作或系统运行异常。您可以尝试卸载这个更新。下面我们就来一起学习下如何卸载Windows 7补丁包的方法和步骤

  步骤1.在开始菜单中,单击“控制面板->程序”。

继续阅读Windows 7怎样卸载补丁包