create account

Linux screen commands - The important commands every Linux user should know by balaz

View this thread on: hive.blogpeakd.comecency.com
· @balaz ·
$39.53
Linux screen commands - The important commands every Linux user should know
The screen is a very good utility on Linux. Especially when we are using Linux servers, it is very important to use Screens in certain use cases. The reason is that we might have some long-running tasks and at that time we cannot expect the connectivity through SSH to stay intact. There is a high possibility that we might have network issues and we might lose connectivity through SSH. In that case, we still want the tasks to be running in the background and we can always connect back when our internet connection is back. 

Restoring a Mongo database can be considered one example of this. Sometimes the database restoration can take several hours and we really don't have to keep the connection to the server until then. We can just create a new screen inside Linux and start the restoration. Now that the process is running on a screen, we can close our laptop and always connect back and get attached to the screen again. This is why I strongly recommend using screens for any long-running tasks. 

![image.png](https://images.hive.blog/DQmWWYeo76WyJbQTqATmWiGQSFkUgRzjStJJtAr2SZVzD1k/image.png)

Let me give an overview of all the basic commands that would be required. I found it really hard to keep a track of all the basic commands that are required. The tutorials I found online were also a bit confusing, giving me a list of commands that are not very useful for me. Every time I work with screens, I find it hard to remember all the commands I regularly use. I thought I will write an article and that way I can also remember the commands for myself. 

### Creating a new screen

> screen -S session

This command will create a new screen and name it a session. Name is not a specific thing, we can call it by any name we want. Just an additional thing for us to remember. In some cases we might use several screens and having a proper name would be easy for us to find out what that screen is all about. There is also no harm in creating multiple screens with the same name. 

### Detaching from the screen

Now there is this concept of attaching and detaching to the screen. When we create a new screen with the above command, we get attached to the screen automatically. So in order to detach from the screen, we can use the below command

> CTRL + A and D

We have to do CTRL + A and then type D to detach from the screen. We will be able to see something like the below saying that we are detached from the screen. 

![image.png](https://images.hive.blog/DQmefm293qxxst6Z56tizrfurFtxBmpzUMZumt396BYQ9ZH/image.png)

### List all the active screens

There is this command that helps us view all the active screens and also lets us know if it is attached or detached. 

> screen -ls

![image.png](https://images.hive.blog/DQmU479BnP8KHjUA7h6sWnjYKEUMNfctcWF7ez4CmcGoxVy/image.png)

In this case, I have only one screen active and I have called it session, so I'm able to see that. In the previous step, I detached from the screen so it shows that I'm Detached. 

### Reattaching to screen

The below command helps us reattach the screen. Here is a small tricky part. 

> screen -r

The above command helps to reattach to the screen automatically only if we have one active screen available. If we have multiple screens, it will still try to automatically attach but sometimes it will list out all the screens and want us to be specific. 

![image.png](https://images.hive.blog/DQmXJdGYHsTCyk4D5dSL5EYUUzXFxCRSqBD9uVUHPBWWLqH/image.png)
If you look at the above, I first created one more screen, detached from that screen, and tried to view the available screens. After that when I tried to use the above-mentioned command, it said there are more than one session so I have to specify which session I should attach again. 

> screen -r 1574370

Now the above command with the screen ID will take me to the respective screen. 

## Deleting a screen

This is the final thing that anyone would like to do. In order to delete a screen, we can first get inside the screen with the `screen -r` command and inside the screen, we have to do the following

> CTRL + A and type :quit

![image.png](https://images.hive.blog/DQmfTmcxug4B3fjpD4U1t7oBGps9zTJhMPqG17Mk97qo4VD/image.png)

After we do CTRL + A and start typing, the typing happens at the bottom of the screen like how it happens inside the VIM editor. After we hit enter, we will be off the screen and the screen will no longer be available. 

I hope these commands were useful for you. I personally felt when it comes to screens, these are the basic commands we have to remember and we don't need anything else. 

---
If you like what I'm doing on Hive, you can vote me as a witness with the links below. 
<center> Vote @balaz as a [Hive Witness](https://vote.hive.uno/@balaz) </center>
<center> Vote @kanibot as a [Hive Engine Witness](https://votify.vercel.app/kanibot) </center>

---

<table>
<tr>
<td>
<center><a href="https://discord.gg/bGmS2tE"><img src="https://images.hive.blog/DQmdthy4q4vyefBYmjMJtx7qHBmLnCfP2btiRPhRyc2U8hP/Indiaunited.png"/></a></center>
</td>
<td>
<center><a href="https://kanibot.com/"><img src="https://images.hive.blog/DQmdm8hKPz9TZL8Gd8bPyeVHm9hfgMqqiHcKL8283RBv2eH/Kanibot.png"/></a></center>
</td>
<td>
<center><a href="https://netbox.global/r/balanbx"><img src="https://images.hive.blog/DQma1a9t6rceDQYvMt6FhNkHuUUjAkQssZHrLJcXKfiQBFd/NetboxGlobal.png"/></a></center>
</td>
<tr>
<td>
<center><a href="https://r.honeygain.me/BALA4F8CD5"><img src="https://images.hive.blog/DQmdCZg8z6sxVukSdPm2kXRAhhnySqPZqK9YQ5hco65sp4n/Honeygain.png"/></a></center>
</td>
<td>
<center><a href="https://www.privex.io/?r=bala41288"><img src="https://images.hive.blog/DQmPB85eAMrQNGV7C4ykbfVTDNaiGmb8PfuiFr2AL8N8JQm/Privex.png"/></a></center>
</td>
<td>
<center><a href="https://www.publish0x.com/?a=YRdG6knybD"><img src="https://images.hive.blog/DQmcb3f3oJvjyxyScbim4gKPAnrHTyXjYtwk7HeC9aTN9Pn/Publish0x.png"/></a></center>
</td>
</tr>
</tr>
</table>
---

Posted with [STEMGeeks](https://stemgeeks.net)
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 171 others
properties (23)
authorbalaz
permlinklinux-screen-commands-the-important-commands-every-linux-user-should-know
categoryhive-163521
json_metadata{"tags":["linux","stem","neoxian","palnet","archon","coding","development","servers","screen","pob"],"users":["balaz","kanibot"],"image":["https://images.hive.blog/DQmWWYeo76WyJbQTqATmWiGQSFkUgRzjStJJtAr2SZVzD1k/image.png","https://images.hive.blog/DQmefm293qxxst6Z56tizrfurFtxBmpzUMZumt396BYQ9ZH/image.png","https://images.hive.blog/DQmU479BnP8KHjUA7h6sWnjYKEUMNfctcWF7ez4CmcGoxVy/image.png","https://images.hive.blog/DQmXJdGYHsTCyk4D5dSL5EYUUzXFxCRSqBD9uVUHPBWWLqH/image.png","https://images.hive.blog/DQmfTmcxug4B3fjpD4U1t7oBGps9zTJhMPqG17Mk97qo4VD/image.png","https://images.hive.blog/DQmdthy4q4vyefBYmjMJtx7qHBmLnCfP2btiRPhRyc2U8hP/Indiaunited.png","https://images.hive.blog/DQmdm8hKPz9TZL8Gd8bPyeVHm9hfgMqqiHcKL8283RBv2eH/Kanibot.png","https://images.hive.blog/DQma1a9t6rceDQYvMt6FhNkHuUUjAkQssZHrLJcXKfiQBFd/NetboxGlobal.png","https://images.hive.blog/DQmdCZg8z6sxVukSdPm2kXRAhhnySqPZqK9YQ5hco65sp4n/Honeygain.png","https://images.hive.blog/DQmPB85eAMrQNGV7C4ykbfVTDNaiGmb8PfuiFr2AL8N8JQm/Privex.png","https://images.hive.blog/DQmcb3f3oJvjyxyScbim4gKPAnrHTyXjYtwk7HeC9aTN9Pn/Publish0x.png"],"links":["https://vote.hive.uno/@balaz"],"app":"stemgeeks/0.1","format":"markdown","canonical_url":"https://stemgeeks.net/@balaz/linux-screen-commands-the-important-commands-every-linux-user-should-know"}
created2022-08-19 06:24:03
last_update2022-08-19 06:24:03
depth0
children9
last_payout2022-08-26 06:24:03
cashout_time1969-12-31 23:59:59
total_payout_value19.794 HBD
curator_payout_value19.731 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length5,986
author_reputation21,572,254,833,423
root_title"Linux screen commands - The important commands every Linux user should know"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id115,846,411
net_rshares56,662,422,550,987
author_curate_reward""
vote details (235)
@curation-cartel ·
![1UP-PIZZA.png](https://files.peakd.com/file/peakd-hive/curation-cartel/23xediR4hotaNsS5pUJrmYVg3YGeTLpui41uCij2jhUDZ4uFT84zoGJf8a8VnfELXLJgt.png) |  <div class="phishy"><u><h4>You have received a __1UP__ from @thecuriousfool!</h4></u></div> The @oneup-cartel will soon upvote you with:<hr> __@stem-curator, @vyb-curator, @pob-curator, @neoxag-curator, @pal-curator__ <hr>_And they will bring !PIZZA 🍕._
-|-

<sup>[Learn more](https://peakd.com/hive-102223/@flauwy/the-curation-cartel-1up-trigger-smart-voting-mana-and-high-delegation-returns-for-14-different-tribes) about our delegation service to earn daily rewards. Join the Cartel on [Discord](https://discord.gg/mvtAneE3Ca).</sup>
properties (22)
authorcuration-cartel
permlinkre-linux-screen-commands-the-important-commands-every-linux-user-should-know-20220819t110631z
categoryhive-163521
json_metadata"{"app": "beem/0.24.26"}"
created2022-08-19 11:06:33
last_update2022-08-19 11:06:33
depth1
children0
last_payout2022-08-26 11:06:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length687
author_reputation1,123,281,846,602
root_title"Linux screen commands - The important commands every Linux user should know"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id115,851,006
net_rshares0
@gwajnberg ·
you are right! screen function is very useful with servers...before knowing about that I was using only nohup which runs programs in the background, but you can see only the log....
!PIZZA
👍  
properties (23)
authorgwajnberg
permlinkrgvrsf
categoryhive-163521
json_metadata{"tags":["stem"],"app":"stemgeeks/0.1","canonical_url":"https://stemgeeks.net/@gwajnberg/rgvrsf"}
created2022-08-19 21:02:39
last_update2022-08-19 21:02:39
depth1
children0
last_payout2022-08-26 21:02:39
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length188
author_reputation151,606,998,724,402
root_title"Linux screen commands - The important commands every Linux user should know"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id115,865,537
net_rshares0
author_curate_reward""
vote details (1)
@hivebuzz ·
Congratulations @balaz! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s):

<table><tr><td><img src="https://images.hive.blog/60x70/http://hivebuzz.me/@balaz/upvoted.png?202208191209"></td><td>You received more than 2250 upvotes.<br>Your next target is to reach 2500 upvotes.</td></tr>
</table>

<sub>_You can view your badges on [your board](https://hivebuzz.me/@balaz) and compare yourself to others in the [Ranking](https://hivebuzz.me/ranking)_</sub>
<sub>_If you no longer want to receive notifications, reply to this comment with the word_ `STOP`</sub>



**Check out the last post from @hivebuzz:**
<table><tr><td><a href="/hive-188409/@hivebuzz/farewell-erikasue"><img src="https://images.hive.blog/64x128/https://i.imgur.com/LdjPLQF.png"></a></td><td><a href="/hive-188409/@hivebuzz/farewell-erikasue">The Hive community is in mourning. Farewell @erikasue!</a></td></tr><tr><td><a href="/nftforpeace/@hivebuzz/nft-for-peace-update2"><img src="https://images.hive.blog/64x128/https://i.imgur.com/tBCp4ps.png"></a></td><td><a href="/nftforpeace/@hivebuzz/nft-for-peace-update2">Level up your NFTs and continue supporting the victims of war</a></td></tr></table>

###### Support the HiveBuzz project. [Vote](https://hivesigner.com/sign/update_proposal_votes?proposal_ids=%5B%22199%22%5D&approve=true) for [our proposal](https://peakd.com/me/proposals/199)!
properties (22)
authorhivebuzz
permlinknotify-balaz-20220819t123136
categoryhive-163521
json_metadata{"image":["http://hivebuzz.me/notify.t6.png"]}
created2022-08-19 12:31:36
last_update2022-08-19 12:31:36
depth1
children0
last_payout2022-08-26 12:31:36
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,421
author_reputation367,790,007,216,560
root_title"Linux screen commands - The important commands every Linux user should know"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id115,852,788
net_rshares0
@indiaunited ·
Indiaunited Curation 1660901219285
This post has been manually curated by @bhattg from Indiaunited community. Join us on our [Discord Server](https://discord.gg/bGmS2tE). 

Do you know that you can earn a passive income by delegating to @indiaunited. We share 100 % of the curation rewards with the delegators. 

Here are some handy links for delegations: [100HP](https://hivesigner.com/sign/delegateVestingShares?delegator=&delegatee=indiaunited&vesting_shares=181632.1775833461%20VESTS), [250HP](https://hivesigner.com/sign/delegateVestingShares?delegator=&delegatee=indiaunited&vesting_shares=454080.4439583653%20VESTS), [500HP](https://hivesigner.com/sign/delegateVestingShares?delegator=&delegatee=indiaunited&vesting_shares=908160.8879167306%20VESTS), [1000HP](https://hivesigner.com/sign/delegateVestingShares?delegator=&delegatee=indiaunited&vesting_shares=1816321.7758334612%20VESTS). 

Read our latest [announcement post](https://hive.blog/hive-186042/@indiaunited/indiaunited-2-0-active-again-with-a-lot-more-energy-this-time) to get more information. 

[![image.png](https://files.peakd.com/file/peakd-hive/bala41288/46eaz12N-image.png)](https://discord.gg/bGmS2tE) 

<sub>**Please contribute to the community by upvoting this comment and posts made by @indiaunited.**</sub>
properties (22)
authorindiaunited
permlinkindiaunited-1660901219285
categoryhive-163521
json_metadata{"app":"hiveblog/0.1","tags":["linux","stem","neoxian","palnet","archon","coding","development","servers","screen","pob"]}
created2022-08-19 09:27:00
last_update2022-08-19 09:27:00
depth1
children0
last_payout2022-08-26 09:27:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,251
author_reputation61,796,578,560,196
root_title"Linux screen commands - The important commands every Linux user should know"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id115,849,203
net_rshares0
@mypathtofire ·
Those are useful things to remember! You cant beat the security you get with Linux, but man using the command line prompt is sometimes a struggle! 😅
👍  , , ,
properties (23)
authormypathtofire
permlinkre-balaz-2022820t1178709z
categoryhive-163521
json_metadata{"tags":["linux","stem","neoxian","palnet","archon","coding","development","servers","screen","pob"],"app":"ecency/3.0.25-vision","format":"markdown+html"}
created2022-08-20 09:07:09
last_update2022-08-20 09:07:09
depth1
children0
last_payout2022-08-27 09:07:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length148
author_reputation514,532,431,199,666
root_title"Linux screen commands - The important commands every Linux user should know"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id115,876,701
net_rshares1,979,620,431
author_curate_reward""
vote details (4)
@pizzabot · (edited)
RE: Linux screen commands - The important commands every Linux user should know
<center>PIZZA! PIZZA! 


PIZZA Holders sent <strong>$PIZZA</strong> tips in this post's comments:
curation-cartel tipped balaz (x1)
@gwajnberg<sub>(2/15)</sub> tipped @balaz (x1)


<sub>Please <a href="https://vote.hive.uno/@pizza.witness">vote for pizza.witness</a>!</sub></center>
properties (22)
authorpizzabot
permlinkre-linux-screen-commands-the-important-commands-every-linux-user-should-know-20220819t110737z
categoryhive-163521
json_metadata"{"app": "beem/0.24.26"}"
created2022-08-19 11:07:39
last_update2022-08-19 21:04:24
depth1
children0
last_payout2022-08-26 11:07:39
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length282
author_reputation6,179,079,134,682
root_title"Linux screen commands - The important commands every Linux user should know"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id115,851,027
net_rshares0
@rishi556 ·
Check out tmux, https://github.com/tmux/tmux/wiki.
properties (22)
authorrishi556
permlinkrheplv
categoryhive-163521
json_metadata{"tags":["stem"],"links":["https://github.com/tmux/tmux/wiki"],"app":"stemgeeks/0.1","canonical_url":"https://stemgeeks.net/@rishi556/rheplv"}
created2022-08-30 02:29:57
last_update2022-08-30 02:29:57
depth1
children0
last_payout2022-09-06 02:29:57
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length50
author_reputation111,989,080,224,041
root_title"Linux screen commands - The important commands every Linux user should know"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id116,156,273
net_rshares0
@thecuriousfool ·
I mostly use windows however I have a Raspberry Pi II in here. I bet this will come in handy when I decided to tinker on my Pi again in the near future. 🙂

Thanks for sharing!

!1UP
<div class="text-center"><a href="https://discord.gg/zQrvxAu7mu"><img src="https://files.peakd.com/file/peakd-hive/thecuriousfool/23wCNPVrixQzBwxnFW1WyKebUHD2SKE9pvPxxpDuZ6kJ76a3RZfbTub5wwB2M8moDPtCP.png"></a></div>
👍  , , ,
properties (23)
authorthecuriousfool
permlinkre-balaz-rgv046
categoryhive-163521
json_metadata{"tags":["hive-163521"],"app":"peakd/2022.07.1"}
created2022-08-19 11:05:54
last_update2022-08-19 11:05:54
depth1
children1
last_payout2022-08-26 11:05:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length397
author_reputation22,355,706,722,182
root_title"Linux screen commands - The important commands every Linux user should know"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id115,850,993
net_rshares1,992,066,003
author_curate_reward""
vote details (4)
@balaz ·
I'm sure it will. Good luck with that. Cheers!
👍  
properties (23)
authorbalaz
permlinkrgvb64
categoryhive-163521
json_metadata{"tags":["stem"],"app":"stemgeeks/0.1","canonical_url":"https://stemgeeks.net/@balaz/rgvb64"}
created2022-08-19 15:03:42
last_update2022-08-19 15:03:42
depth2
children0
last_payout2022-08-26 15:03:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length46
author_reputation21,572,254,833,423
root_title"Linux screen commands - The important commands every Linux user should know"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id115,856,394
net_rshares0
author_curate_reward""
vote details (1)