代码改变世界

Linux 学习笔记

2019-02-21 15:05  Wizardlsw  阅读(192)  评论(0编辑  收藏  举报

Basic Concept

在Linux中所有的东西都对应着一个文件,不同用户有不同的目录与默认约定的对应目录,比如:

user type folders, files
root /sbin , /usr/sbin
all users /bin, /usr/bin

Abbreviations:

  • bin: binary
  • usr: user
  • sbin: super binary

Options:

  • -a : all
  • -l: long:

drwxr-xr-x

文件类型

  • d 目录directory
    • 二进制文件
  • l 软链接文件 link

Check Linux Version

How to check linux kernel version number?
Open a shell prompt (or a terminal) and type the following command to see your current Linux kernel version:

$ uname
# OR
$ uname -mrs 
OR 
$ uname -a # for all information

Example output (aws linux AMI):

4.14.77-70.59.amzn1.x86_64

或者:

$ cat /proc/version

Example outputs 1 (CentOS):

Linux version 3.10.0-957.1.3.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ) #1 SMP Thu Nov 29 14:49:43 UTC 2018

Example outputs 1 (amazon linux AMI):

Linux version 4.14.77-70.59.amzn1.x86_64 (mockbuild@gobi-build-64001) (gcc version 7.2.1 20170915 (Red Hat 7.2.1-2) (GCC)) #1 SMP Mon Nov 12 22:02:45 UTC 2018

For CentOS, we can also use following command to get system information:

more /etc/redhat-release
cat /etc/redhat-release

Example output:

CentOS Linux release 7.6.1810 (Core)

Check CPU information

more /proc/cpuinfo | grep "model name"  

Example outputs:

model name : Intel(R) Pentium(R) Dual CPU E2180 @ 2.00GHz

Check Memory Information

more /proc/meminfo
more /proc/meminfo | grep MemTotal

Commands

find

find -name file-name-to-be-found

Tools

You can use following tools:

  • PuTTy
  • Git Bash (git bash get SSH integrated already)

References:

在Azure上的Linux使用SSH
how to use ssh to connect a remote server in ubuntu

# ssh remote_host
# ssh remote_username@remote_host
# exit