Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have been mostly using Windows but I know my way around a Linux system but I am not as productive as in Windows.

I am looking for some "survival" guidelines on what should I focus to be able to improve my productivity in Linux (mainly, being more efficient with the command line interface).

share
    
I don't have that many general suggestions, but of course you should already know man, apropos, and info. As you code, you would probably benefit from installing and using ack (link) in preference to grep. Knowing xargs and find is also very helpful for a huge range of tasks. Knowing how to use aliases (run man alias for details) will save you mistakes and extra typing time for executing commands with commonly used options. In terms of shell features, other key parts are for loops, shell patterns, and all the different types of redirections you can do. –  kampu Jun 15 '13 at 1:47
comments disabled on deleted / locked posts

migration rejected from programmers.stackexchange.com Jun 15 '13 at 5:34

This question came from our site for professional programmers interested in conceptual questions about software development. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as not a real question by camh, slm, Anthon, Michael Mrozek Jun 15 '13 at 5:34

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

5 Answers

"Linux" is extraordinarily vague, in large part because there are different desktop environments, which can directly affect your productivity (to draw an analogy to Windows - Windows 8 and Windows XP have very different desktops environments and workflows). You'll probably get more help if you can at least provide us with the version of Linux you're running (ie - the distribution). It would also help if we knew what it was you were doing that you feel you're losing productivity on.

That said, here are some general things that will help you:

Learn your desktop environment. If you're running Fedora or Ubuntu, you're very likely running on Gnome 3 or Unity (respectively). You can greatly speed up your workflow by learning and using some of the major key combinations. One of the big ones is to press Super (the Windows key) and start typing. Pressing Super brings up the "Activities" pane (the same as clicking the Ubuntu icon or "Activities"), and typing will automatically start searching for the relevant application or document. (Pro tip - this works in Windows 7 and 8, as well, though 7 isn't nearly as comprehensive.) Likewise, the other desktop environments have similar hot keys and other little productivity increasing secrets. Do some research to find them, then learn and use them.

Learn the basic command line commands. If you've used the Windows command line at all, then some things will be familiar to you. Things like cd and mkdir work the same on Linux. From there, the Linux command line can go quite a bit farther. grep, especially when combined with ls and the pipe symbol can allow you to search folders for specific files (ex - ls | grep myFolder). Additionally, if you connect to remote servers for any reason, ssh will be your friend, as well. Also, apt-get, yum, or your distribution's package manager can be many times more efficient when installing things (particularly a laundry list of things) than their GUI counterparts.

Immerse yourself in the command line. If you really want to learn, in depth, what to do within the command line, try using just it for a week or two. Keep only a browser open to look things up (or, pick up a terminal browser!), to find out how to do things in terminal.

Write some shell scripts. The idea here would be to automate certain tasks. Something like getting a computer fully set up from stock install to your customized environment is a good way to learn about the different commands available to you. You learn a lot about what you can do even with the commands you already know, when you have to set it up so that a script will run by itself.

Determine what, exactly, you're trying to be more productive at. Being "more productive" is, as I mentioned, quite vague. What are you trying to do? Are you trying to write code in Vim? Or are you trying to set up and maintain a web server? What is it that you're finding yourself going too slow with? Find that out, then you can do a targeted search for the "better way" of doing what you're doing.

share
    
+1.I mainly work doing ssh on a remote Linux server.I write code and use vim but I am bellow intermediate level (or roughly intermediate). I search for files,string,code, recently learned that such feature as tmux exist and general I am losing time because I don't have a good guideline on what to practice/study in order to be able to catch up –  Cratylus Jun 14 '13 at 19:58
    
Would it be possible to give a couple of examples for doing something efficiently that I would need to use shell scripting vs not knowing? –  Cratylus Jun 16 '13 at 9:06
    
Anything you can do manually, you can script, and vice versa. However, writing a script forces you to learn things about commands you might not have known about. Using my setup script example, the -y switch for apt-get and yum come to mind. It automatically accepts the confirmation, allowing you to start an install (or uninstall) and walk away, meaning you don't have to babysit it until you get that prompt, buying you what could add up to hours of time. –  Shauna Jun 17 '13 at 14:35
add comment

I'm going to be specific, as opposed to the general recommendations above:

Efficient Text Editing

I use vim, and I think you should, too, so I'll list a couple of "efficient editing" docs:

In the name of all that does not suck, do not use the arrow keys to move around in a vim window. Learn the hjkl movement keys.

Efficient Interactive Shell

You should probably use bash as your shell scripting language, but you should use Zsh as your interactive shell. Zsh does spelling correction, so you can just confirm that you meant make when you typed mkae, for example. You can set Zsh up to complete command line words when you hit the 'tab' key. You can set Zsh up to do informative prompts. Use of RPROMPT can really save time. My prompt looks like this:

bediger@dagoo
3 %                                            # /home/bediger/src/csrc

I'm user 'bediger' on a host named 'dagoo'. My typing goes at the '%', and I've issued two commands previously. My working directory is /home/bediger/src/csrc

Zsh can also be set to cd to whatever directory you paste in on the command line, you don't need to type 'cd ' then paste. A real time-saver.

Copy-n-paste 1: mouse buttons

Use the old X11 school copy and paste: left mouse button swipes or starts the mark. Marking is implicit copying, because, let's face it, why else are you highlighting that text? Right button extends the mark/highlight. Middle button pastes. PuTTY can be set to understand this. Cygwin terminal understands it. Xterm understands it. It saves you clicks.

Copy-n-paste 2: hot key paste

Set up a hotkey paste that you can use from the keyboard. This will keep you from taking your hands off the keyboard groping for the mouse, then groping for the home row. I have this in my .Xresrouces file:

XTerm*VT100*translations: #override \n\
    <Key>F2: insert-selection(PRIMARY,CUT_BUFFER0)

That lets me use the f2 function key on 104-button keyboards to paste into xterm windows, in which I run Zsh and Vim.

It's best to use hotkeys that your non-mouse-hand can work. That way, your mouse hand only coordinates mouse movement, and will probably work faster and more accurately.

Copy-n-paste 3: better definition of "a word"

This is for xterm mainly, but I did get PuTTY to understand this. Change the definition of "a word" so that double-clicks can pick up entire file names. From my .Xresources file:

XTerm*VT100.charClass: 33:48,35:48,37:48,42:48,45-47:48,64:48,95:48,126:48

Once you merge in that resouce, '/', '.', '*' and a few other common characters are now part of "a word". When you double-click on a file name in an xterm, you will highlight (and implicitly copy!) the whole file name which is mostly what you want to do.

Copy-n-paste 4: extra goodies

A few more entries from .Xresources:

XTerm*VT100.cutNewLine: false
XTerm*VT100.cutToBeginningOfLine: false

This means that a triple-click highlights from the word the mouse is on to the end of the line, but does not pick up the newline itself.

You can then paste into a Zsh prompt, do minor editing, and hit return. This makes it a lot faster to pick up parts of lines of text or parts of previous commands, then modify or correct them. It increases re-use.

Use a cut buffer display manager. I use xcb for its speed and simplicity. There are others. xcb lets you save 7 items as well as the primary cut buffer (see above for a hotkey paste thing), and get at them with a click.

Window Manager Settings

Use focus-follows-mouse. "On top" and "in focus" don't conflate all that well and make your windowing system act like a bunch of modal pop-ups. If you use focus-follows-mouse, you can leave a window on top of an xterm that only shows the command prompt. Copy-n-paste from the window on top to the Zsh prompt is easy and fast with focus-follows-mouse.

If you use a window manager that allows defining hotkeys, define "come to the top" hotkey, and "iconify" hotkeys. They will come in handy, especially if you define hotkeys for your non-mouse hand. You can move the mouse to a window, and hotkey it into an icon, move again, iconify, etc. Very rapid.

Pick a window manager that makes sensible use of icons: does an icon represent a running process, a file, or what? Think about placing icons on the edges of the screen so that you get a little relief from Fitt's Law. If an icon is on or slightly off the top of the screen, your hand doesn't need to control the vertical movement of the mouse, you just ram it against the top of the screen. Your hand only has to coordinate left-right location.

share
    
Very helpful thank you.1)Is Zsh a separate install? Also I have read that bash can be "integrated" with git and e.g. show you which branch you are on. Does Zsh offer such things? 2) .Xresrouces I do not know what is this :( –  Cratylus Jun 16 '13 at 10:22
    
I don't know if Zsh is a separate install: it is for Arch linux, but I don't know what distro you use. I'm sure Zsh offers git integration, but I haven't needed that. X11 startups usually run a script $HOME/.xinitrc. .xinitrc in turn runs xrdb -merge $HOME/.Xresources Those "resources" are settings and so forth that the X11 server communicates to clients that ask for them. Almost all clients do ask. –  Bruce Ediger Jun 16 '13 at 23:16
1  
Zsh is typically a separate install, IME. Additionally, zsh is generally considered an extension of Bash, so anything Bash can do, zsh can do (and more), and yes, that includes "git integration". I recommend checking out Zach Holman's Dotfiles GitHub repo, which includes some extensive customizing of zsh for use with Git. –  Shauna Jun 17 '13 at 14:45
add comment

Definitely need to emphasize and re-emphasize making sure that you do everything in the command line. If you don't know how to do something, look it up. If you forget, look it up again (no one can remember everything anyway). Don't be afraid to just "play around" with things to see how they work and get a feel for how to do things - you'll often find that last week's "game" will be this week's lifesaver.

You need to be willing to pay a temporary loss in productivity for eventual (large) returns in efficiency. Never stop asking yourself "is there a better way to do this?" Patience and curiosity will pay off :-)

The same goes for learning a text editor (e.g. vi or emacs). On that note, I've heard great things about vimtutor.

If you want something to start off with, pick something simple like renaming all of your photos to have .jpg instead of .JPG. Also, make lots of backups if you are aggressive with your exploration.

share
    
+1 for 'last week's "game" will be this week's lifesaver.' –  Evan Teitelman Jun 15 '13 at 1:36
add comment

I would recommend to press CTRL+ALT+F1 together, login, and forget about GUI with its distracting elements, and start to read man pages on commands that you want to master.

share
add comment

rlswrap adds Zsh/Bash-style command-line editing to programs that don't supply it themselves (like unix standbys dc, bc).

share
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.