linux mmap 示例_带有示例Linux屏幕教程

linux mmap 示例

linux mmap 示例

Linux screen is a tool used to multiplex single ssh terminal easily. The screen has a strong competitor named tmux where we will look next posts. The screen has these abilities to make system administrators life easy.

Linux屏幕是用于轻松多路复用单个ssh终端的工具。 屏幕上有一个强大的竞争对手,名为tmux,我们将在其中查找下一篇文章。 屏幕具有这些功能,可简化系统管理员的工作。

  • Multiple screens in a single ssh connection

    单个ssh连接中的多个屏幕
  • Running commands after ssh disconnect

    ssh断开连接后运行命令
  • Resuming screen sessions after ssh disconnect

    ssh断开连接后恢复屏幕会话
  • Easily dividing and multiplexing single window

    轻松分割和复用单个窗口

安装(Install)

Installing screen is easy like below.

安装屏幕很容易,如下所示。

We will use the following command in order to install screen in the deb based distributions like Ubuntu, Mint, Kali, and Debian.

我们将使用以下命令来在基于deb的发行版(如Ubuntu,Mint,Kali和Debian)中安装屏幕。

$ sudo apt install screen
Install
Install
安装

We will use the following command in order to install screen in the rpm based distributions like Fedora, CentOS, Red Hat.

我们将使用以下命令以便在基于rpm的发行版(例如Fedora,CentOS,Red Hat)中安装屏幕。

$ sudo yum install screen

人屏 (Man Screen)

To get more detailed help about screen command use man screen command like below

要获取有关screen命令的更多详细帮助,请使用如下所示的man screen命令

$ man screen
Man Screen
Man Screen
人屏

启动Linux屏幕(Starting Linux Screen)

The screen can be started with a simple screen command like below. This will create a new shell same as default shell.

屏幕可以通过如下所示的简单屏幕命令启动。 这将创建一个与默认外壳相同的新外壳。

$ screen

After issuing screen command we will see a notice about shell we will start like below. This page provides summary information about screen shell where we look more details later this post.

发出screen命令后,我们将看到有关shell的通知,我们将开始如下所示。 本页提供有关屏幕外壳的摘要信息,我们将在本文后面提供更多详细信息。

Starting Linux Screen
Starting Linux Screen
启动Linux屏幕

Press Space to start a shell

空格键启动外壳

Starting Linux Screen
Starting Linux Screen
启动Linux屏幕

This is a screen shell which is the same as the bash shell.

这是一个屏幕外壳,与bash外壳相同。

检查屏幕是否运行 (Check If Screen Whether Running)

While working a lot of servers we may need to check if the screen is running. to get status of current shell bash environment variables provides infomraion about terminal with TERM variable. We can see current terminal from here.

在使用许多服务器时,我们可能需要检查屏幕是否正在运行。 获取当前shell bash环境变量的状态可提供有关带有TERM变量的终端的信息。 我们可以从这里看到当前的终端。

Check If Screen Whether Running
Check If Screen Whether Running
检查屏幕是否运行

We can see from the result that the current shell is screen and color support is 256 color with xterm .

从结果中我们可以看到,当前的外壳是屏幕,并且xterm支持颜色为256色。

控制指令 (Control Command)

The screen provides a lot of features. to activate these features some keyboard short cuts used. We call these shortcuts as screen commands. To send command to the screen there is a command named control command. Control command simple specifies next command is about the screen. The default control command is Ctrl+a 

屏幕上提供了很多功能。 要激活这些功能,请使用一些快捷键。 我们将这些快捷方式称为屏幕命令。 要将命令发送到屏幕,有一个名为control command的命令。 控制命令简单指定下一个关于屏幕的命令。 默认控制命令是Ctrl + a

Ctrl+a

建立新视窗 (Create New Window)

One of the most used features of the screen is creating new windows. As we stated before the screen can create more than one windows with a single terminal which is very useful for system administrator. Shortcut for creating a new window is

屏幕上最常用的功能之一就是创建新窗口。 如前所述,该屏幕可以通过一个终端创建多个窗口,这对于系统管理员非常有用。 创建新窗口的快捷方式是

Ctrl+a c

First press control command which is by default Ctrl+a and after press .This will create a new window with shell-like below.

首先按默认为Ctrl + a的控制命令,然后按c 。这将创建一个新的窗口,下面是类似shell的窗口。

Create Window
Create Window
建立视窗

切换下一个窗口(Switch Next Window)

In a typical screen usage there will be more than one windows so how can we switch between these windows. In order to switch next window use

在典型的屏幕用法中,会有多个窗口,因此我们如何在这些窗口之间切换。 为了切换下一个窗口使用

Ctrl+a n

切换上一个窗口 (Switch the Previous Window)

Another navigation shortcut for the screen is switching the previous window. Switching between windows do not end the process or close the current window.

屏幕的另一个导航快捷方式是切换上一个窗口。 在窗口之间切换不会结束进程或关闭当前窗口。

Ctrl+a p

从屏幕上拆卸 (Detaching From Screen)

Another very popular usage of the screen is detaching from the screen. Think about these scenarios. We are copying some big files but have go out by closing ssh session. In this situation, we can detach current screen session and then reattach.

屏幕的另一种非常流行的用法是与屏幕分离。 考虑一下这些情况。 我们正在复制一些大文件,但是由于关闭ssh会话而退出。 在这种情况下,我们可以分离当前的屏幕会话,然后重新附加。

Ctrl+a d

列出现有会话 (List Existing Sessions)

To reattach screen sessions we may need to list current existing sessions. The screen provides -list option to list these detached sessions with the date-time information and session name.

要重新附加屏幕会话,我们可能需要列出当前的现有会话。 屏幕上提供了-list选项,以列出这些分离的会话以及日期时间信息和会话名称。

$ screen -list
List Sessions
List Sessions
列出会议

列表画面处理(List Screen Process)

We can look for existing screen sessions in a server. The screen runs as a process like a bash session.

我们可以在服务器中寻找现有的屏幕会话。 屏幕像bash会话一样运行。

$ ps aux | grep screen
List Screen Process
List Screen Process
列表画面处理

As we see processes id 12336 is our current screen terminal

如我们所见,进程ID 12336是我们当前的屏幕终端

重新连接(Reattach)

We can terminate our connection to the remote server. Then we can reconnect the server and continue with the previously created screen sessions. This is called as reattach. We will reattach the screen session after connection our server with ssh.

我们可以终止与远程服务器的连接。 然后,我们可以重新连接服务器并继续先前创建的屏幕会话。 这称为reattach 。 将服务器与ssh连接后,我们将重新连接屏幕会话。

$ screen -r
Reattach
Reattach
重新连接

As we see if there is only one screen session to reattach it will automatically be reattached but there are more than one screen session so we should specify which one we want to reattach

如我们所见,如果只有一个屏幕会话需要重新连接,它将自动重新连接,但是有多个屏幕会话,因此我们应指定要重新连接的会话

$ screen -r 12587.pts-12.ubu1

保存终端命令 (Save Terminal Commands)

While working in remote systems we will issue a lot of commands. Remembering these commands can be hard some times especially if we try a lot of things to solve a problem. Screen provides logging commands of running sessions. After a session ends we can look commands issued at this session. To enable command history use following command.

在远程系统中工作时,我们将发出很多命令。 有时候记住这些命令可能很困难,特别是如果我们尝试很多事情来解决问题的话。 该屏幕提供正在运行的会话的日志记录命令。 会话结束后,我们可以查看在此会话中发出的命令。 要启用命令历史记录,请使用以下命令。

Ctrl+a H

After issuing shortcuts a logfile named screenlog.0 is created.

发出快捷方式后,将创建一个名为screenlog.0的日志文件。

读取历史记录 (Read History Log)

History log files by default named screenlog.id . They are simple text files and can be read with cat like below.

默认情况下,历史记录日志文件名为screenlog.id 。 它们是简单的文本文件,可以用cat读取,如下所示。

$ cat screenlog.0
Read History Log
Read History Log
读取历史记录

禁用保存终端(Disable Saving Terminals)

After enabling terminal logging we disable it with the same command for enabling like below.

启用终端日志记录后,我们使用相同的启用命令将其禁用,如下所示。

Ctrl+a H
Disable Saving Terminals
Disable Saving Terminals
禁用保存终端

启用监控(Enable Monitoring)

While working multiple windows we can run some command and switch to the next windows. How can we notify if previous windows command is completed? The screen has ability to monitor windows and provides notifications if the commands have finished.

在使用多个窗口时,我们可以运行一些命令并切换到下一个窗口。 我们如何通知以前的Windows命令是否完成? 屏幕具有监视窗口的功能,并在命令完成后提供通知。

Ctrl+a M
Enable Monitoring
Enable Monitoring
启用监控

禁用监控(Disable Monitoring)

Simply issuing same command t enable monitor will disable monitoring for the current window.

只需发出相同的命令t enable monitor将禁用对当前窗口的监视。

Ctrl+a M
Disable Monitoring
Disable Monitoring
禁用监控

锁屏会话(Lock Screen Session)

Screen session have the ability to lock which is very similar like desktop managers screen lock. To unlock screen current users system password should be entered.

屏幕会话具有锁定功能,这与桌面管理器的屏幕锁定非常相似。 要解锁当前用户的屏幕,应输入系统密码。

Ctrl+a x
Lock Screen Session
Lock Screen Session
锁屏会话

停止或退出屏幕(Stopping or Exit Screen)

The best practice screen after usage is closing the screen session with the shortcut below. This will close all windows of the current session.

使用后的最佳实践屏幕是使用以下快捷方式关闭屏幕会话。 这将关闭当前会话的所有窗口。

Ctrl+a k
Stopping Screen
Stopping Screen
停止画面

This will ask question “Really kill this window [y/n]” press to kill session

这将问问题“真的杀死这个窗口[y / n] ”按y杀死会话

翻译自: https://www.poftut.com/linux-screen-tutorial-examples/

linux mmap 示例

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值