Software Engineer

more tricks!

· by jsnby · Read in about 1 min · (212 Words)

I learned two cool new tricks from the senior guys today. They are moving everyone’s office today, so that means I have to have my computers packed up by 2PM. The problem is that I have a long-running job that I need to have run over the weekend. Since my machines will be in storage until Monday, I couldn’t just run it on my workstation and lock the machine up. The guys here recommended using the screen command. It allows you to create a screen session, kick off jobs, disconnect, then re-attach to the session later. This is exactly what I wanted.

To start a session: screen -R -D -S <name of session>

I picked jasonjob for . This starts the session. Start your job, then hit Ctrl+a, d to disconnect from the session.

To reconnect to the session, type: screen -R -D -S <name of session>

If you forgot the name of your session, type this to list all open screen sessions: screen -ls

Sweet, right? The next trick I felt really dumb for not knowing about. Imagine you have a command like screen and you don’t know what package it’s a part of, but you’d like to find out. You can ask rpm to tell you: rpm -q --whatprovides screen