Some cool Linux tips/tricks - gHacks Tech News

Some cool Linux tips/tricks

It's Friday and that means we're all ready for the weekend. But that also means we're ready for some fun. Because of that I thought it would be fitting to do an article on some of the cooler Linux tips and tricks that I have come across over the years. This article will be a bit of mish-mash of topics...but well worth the read. So, without further adieu, let's cry havoc and let loose the dogs of war!

Collaborate with the screen command

Let's say you and your co-worker are both working on debugging an application and your partner has run into a snag. Instead of having to march back and forth between offices, or leaving the comfort of your own chair (you lazy thing), you can log onto your co-workers machine and collaborate! Here's how it works. Both machines will be Linux machines and both will have ssh accessibility. If you need to help your co-worker out follow these steps:

  1. Secure shell into your friends machine...the only catch is, you have to log on with his username/password.
  2. Issue the command screen -s NAME Where NAME is any name you want.

Now your co-worker has to open up a terminal window and issue the command screen -x NAME Where NAME is the same name you used in your command. Now whenever either of you type in your screen both of you will see what is going on at the same time.

To detach yourself from this session you have to hit <Ctrl>a and then d. That means hold down <Ctrl>, hit a, and then hit d. You will be released from the session.

Execute files as programs in GNOME

Say you have that killer bash script you use for something tucked away in your home directory. You can run that script by open up a terminal window and issuing the command to run the script, OR...you can set up Nautilus so that files can be run with a simple double click. Now, use caution with this, because it can open up security issues. But if you know you are safe (are you ever really safe?) you can set this feature.

To set this up open up Nautilus to the directory that will house the script and then right-click the script and select Properties. In this new window click on the Permission tab and then check the box for Execute. Close the Properties window and then, back in Nautilus, double click that script and see what happens...it should execute.

Double your copy/paste pleasure

You have have heard me mention before how Linux has a cool way to copy paste. You simply highlight what you want to copy with the left mouse button (click and drag to select) and then click the middle mouse button to paste. But did you know that form of copy/paste does not effect the traditional <Ctrl>c/<Ctrl>v? That's right. So effectively you have a primary and secondary buffer for copy/paste. You can highlight section A with the left mouse button drag/highlight method and then copy section B with the standard <Ctrl>c method. Now you two different pieces of text to paste - one with the middle mouse button and the other with <Ctrl>v! Sweet.

Final thoughts

There's your fun friday Linux tricks. Now, go out and enjoy the weekend! Or just sit at home and continue to rock away on your Linux box.

We need your help

Advertising revenue is falling fast across the Internet, and independently-run sites like Ghacks are hit hardest by it. The advertising model in its current form is coming to an end, and we have to find other ways to continue operating this site.

We are committed to keeping our content free and independent, which means no paywalls, no sponsored posts, no annoying ad formats or subscription fees.

If you like our content, and would like to help, please consider making a contribution:

Comments

  1. GUEST said on May 15, 2010 at 10:44 am
    Reply

    > the only catch is, you have to log on with his username/password

    No you don’t. The friend adds your public key to their .ssh/authorized_keys file, and removes it again later.

  2. Backpacker said on May 17, 2010 at 2:02 am
    Reply

    “without further adieu” … um, that would be “without further ado”, but maybe your version is better. :-)

  3. Slarti said on May 17, 2010 at 3:29 am
    Reply

    According to the man page for screen, that should be a CAPITAL -S, not a lowercase -s.

  4. kaddy said on May 17, 2010 at 5:12 am
    Reply

    I was just about to post the same thing that Slarti said…. I found also that it has to be -S and not -s

    can the author of this page please fix the command

  5. Douglas said on May 17, 2010 at 10:56 am
    Reply

    Forget about the password/key-sharing. You can share screen-session across users, provided that your version of screen is compiled with multiuser-support.

  6. Anonymous said on May 17, 2010 at 11:39 am
    Reply

    How many weeks or days have you been using Linux, Jack ?

    The way that you describe using the “screen” command is totally out of scope here, since Linux provides a direct method for remote chat with the command “talk”. No need to login and whatnot, works remotely and all.

  7. Anonymous said on May 17, 2010 at 6:09 pm
    Reply

    “Execute files as programs in GNOME”

    First of all, nautilus is not limited to Gnome, I am using KDE, and can run nautilus just fine!

    Secondly, if you have already created a “killer bash script”, you would have already set the execute bit in bash by issuing the command:

    chmod +x filename

    This would allow you to issue the command as “./filename” (In the current directory) or “/path/filename” rather than having to use “bash filename”, or “bash /path/filename”.

    Setting the execute bit in nautilus would only be needed if the execute bit had not been set in bash. By setting it in nautilus, you are setting the execute bit on the file itself, as in the command above. Cool Linux tips/tricks? No, this is bash 101!.

  8. Shocky said on May 17, 2010 at 8:07 pm
    Reply

    Concerning the screen tip, you can do the same thing for graphical programs using vnc. The remote user just has to start a vnc server session, assign a password (doesn’t have to be their login password), and give you the coordinates. Then you can both connect. You even each get your own mouse pointer.

  9. Lava Kafle said on May 28, 2010 at 12:27 pm
    Reply

    nice teachings thanks

  10. pb said on June 13, 2012 at 6:35 pm
    Reply

    Password apart, I like the ssh one. But I’ve bumped into this while looking for Nautilus tricks in particular, but there’s none here! So I made one: http://giuliopepe.blogspot.co.uk/2012/06/10-nautilus-tips-and-tricks.html

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

Please note that your comment may not appear immediately after you post it.