How to improve one's bash/command-line skills? [closed] - bash

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
Unfortunately I come from the Windows world and quite a newbie to Linux. I see people who are really productive due to their skills with BASH. Any pointers, tutorials, bools or suggestions to improve one's command-line skills? Something like http://www.commandlinefu.com/.

Check out superuser.stackexchange too, lots of good stuff there!
This is what I reference at least a few times a week:
Advanced Bash-Scripting Guide
And here is an actual List of Bash online-tutorials!
I would also like to emphasize what #serk's answer says:
Remove your GUI and you'll be forced to do everything via BASH
This is Very good advice! (and a well earned competing answer +1 vote ;)
In /etc/inittab change the runlevel to 3 from 5 and consequently you have to learn the shell because runlevel 3 means no GUI at all!

Remove your GUI and you'll be forced to do everything via BASH. That will force you to do the same tasks via the command line that you would have normally done via the GUI.

In addition to what's already been listed you can run man <command> to give you the "manual page" for a particular program. These are usually pretty good.
Many people you likely work with have customized bash and tools like vim/emacs to varying degrees. To see how people have customized things, you can go to their home directories and check out their "dot" files. "dot" files are hidden so to view them you'll have to run:
ls -a
Standard "dot" files/directories:
.bashrc
.bash_profile
.vimrc
.screenrc
.inputrc
Common dot file names:
.alias(es)
.function(s)
People sometimes also write common scripts and put them in bin or scripts directories.
You can learn a TON of stuff by checking out what others have done.
If you are just checking out linux on your own, you can look for these types of files online.
Since you're coming from windows, you may be using cygwin. If so, you can check out C:\cygwin\bin and C:\cygwin\usr\sbin for typical bash programs. You can also use cygwin on windows in general to allow you to continue to use bash when using your windows computer.

Related

My vim directory is in a weird place, should it be moved? [closed]

Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 months ago.
Improve this question
So I wanted to set up my new PC and vim was one of the first things.
I need my .vim directory for that. I have vim and it works, too.
I found the indent folder at /usr/share/vim/vim90/indent. This seems to be the correct folder but I have no idea if this is the correct location. The .vimrc i created at ~/.vimrc.
There are as far as I could find two possible "proper" places for .vim, which is ~/.vim and /etc/vim. It is in neither.
What should be the next step to properly use vim? Should I leave it there? Should I create .vim in my home dir and move it there? Does it literally not matter and I am confusing over nothing?
Thanks for any help!
/usr/share/vim/vim90/ is the system-wide "runtime directory". What is in there shouldn't be messed with because…
it needs to be in a certain state for Vim to work as expected,
whatever you do there might be overridden or left behind during later upgrade,
other users might be negatively impacted by your changes.
The first reason is sad, but yeah, Vim is a fragile beast, the working of which can be compromised very easily by moving stuff around, renaming files or whatnot.
The second reason is, I think, easy to demonstrate: when 9.1 is released, it will ignore /usr/share/vim/vim90/ entirely, and thus whatever changes you might have done there.
The third reason might seem more abstract because you are probably the only actual person to use that particular computer, but Unix-like systems are multi-user by design and, in that context, keeping your changes in your own $HOME is just common sense.
Vim is highly configurable and offers many ways to craft the perfect personal environment… or shoot yourself in the foot so, for now, you should do your configuration in your own $HOME as it is simple and predictable:
create a .vim directory under $HOME, $HOME/.vim,
create a .vimrc file under $HOME, $HOME/.vimrc,
and forget that /usr/share/vim/vim90/ ever existed.

why does windows have so many shells and command line interfaces? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
I have recently switched from MacOSX to Windows, and having had much experience using the OSX Terminal, I've been surprised by how many different CLI's there are in Windows. Specifically, it seems that in addition to cmd.exe and powershell, when I have installed some programs that require CLI usage, they create their own CLI's, i.e. git cmd, git bash, etc.
I'm used to working within one single app (terminal) for all of my projects/tasks, and switching between different CLI's for various tasks is proving annoying and confusing.
I'm not sure I'm asking the right question, so please let me know if you need a different one...: For those of you who have experience working at the command line in windows, is it 'normal' to keep switching between CLI's for different needs, or is it reasonable to get to a point with one CLI (i.e. powershell)? And if so, what should I be looking into?
Thanks in advance!
Standard Cmd/Windows Command windows is basically your backwards compatible shell for Windows that will run everything specifically developed for it, including DOS batch files, etc.
Powershell is a supercharged, newer command window that allows scripting that is compatible with modern system administration for server environments in organizations, similar to vbscript or javascript. Admins can run more compatible/modern scripting than the old DOS Batch files. It's really a new/separate scripting language, while still supporting most basic Windows Cmd window commands.
Git installs Git-cmd, which basically acts like a normal windows command terminal, and Git-Bash launches a unix-style Bash shell, because Git originated on Linux (and for Linux development..) and it's core operations expect a lot of core Linux commands, libraries and/or utilities. So the Git-Bash is part of the standard install, giving you essentially a mini Linux install (or perhaps better phrasing would be a POSIX-compliant one?) and allows you to run a lot of tools/aliases/scripts developed for Git directly on Linux, and should be no different from a Linux Bash shell if you just happen to prefer that to Windows Cmd, with all basic command differences.
So I wouldn't say that there are "so many" different terminals. Unix/Linux has many different flavors as well (C-shell, Bash, Ksh, etc.). Powershell is rarely required for a regular user (per the comments, much more by developers), and Git Bash is unnecessary to run Git.
Isn't more options better - use what you like? :)

Is there an IDLE-like editor for ruby on Windows or Ubuntu? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I'd like to introduce my young cousin to a bit of programming. Ideally ruby, as that's what I'm familiar with. However finding a suitable text editor is a real pain. All I need of the editor is the ability to type a few lines of code, press 'Run' and get some results (or not, as the case may be). The simpler the editor the better, I don't need Netbeans, Eclipse etc. What I want to avoid is the necessity of using the terminal to run scripts, TextWrangler, Textmate and IDLE for Python can do this.
Unfortunately I need something that will work on Windows, or Ubuntu, otherwise I would have just installed Textmate on his laptop.
Any suggestions would be greatly appreciated.
You can do this in SciTE, which is bundled with the Windows Ruby installer or can be downloaded here. Click Tools > Go or press F5. It's an all-around good (and fast) editor with not a lot of bells and whistles.
This might require some configuration to make sure SciTE knows where your Ruby executable is. I believe the configuration for this is in Options > Open ruby.properties > command.go.*.rb.
On Ubuntu... How about the good old Gedit application? The Tool Launcher Plugin will enable you to run any external task (including the execution of the current open file.
Many thanks for all the suggestions, though having tried multitudes of editors, the option I've went with is Geany.
http://www.geany.org/
I couldn't get ScITE to work properly with standard input on either Windows or Ubuntu.
Ruby is a great language that could also be attractive to absolute beginners, however, the fact that the ruby installer does not include a basic editor that can be used in a self contained manner (to write and run scripts) really hinders its use for beginners.
This struggle to find an editor that could be used for writing and running ruby scripts almost had me resorting to python!
redcareditor has a "run" option under plugins -> execute
it's quick and dirty :)
I've used SciTE before for that sort of purpose. It reportedly works on Linux as well as Windows, but I haven't tried the Linux version myself.
Take a look at FreeRIDE for an IDE-type solution. You can also run code directly from the SciTE editor.
Well, on Windows, you can get E-Text Editor. It's basically a TextMate clone for Windows that runs TextMate commands and snippets.
30 day trial, then a little under $50 for full version.
I have no affiliation with the creators/owners of E-Text Editor
I use two editors that way, one is old school but only for Windows: Textpad , it also lets you enter parameters. Because of its popularity and power i'm trying to switch to Sublime Text, it is multi OS.
It takes some effort getting used to because i worked with textpad for many years but is is very powerfull and for Ruby development it is now my favorite workhorse. You can also find many tutorials and Youtube demos because of it's popularity.

Suggestions for porting linux application to windows [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'd like to port an application written under linux to windows. Currently I'm using Cygwin but I'm curious if there are any other options that don't force me to release my source since I'm not in the position to do so right now. Are there any other options short of having to completely re-write it or buying a license?
MinGW doesn't have as many licensing restrictions as Cygwin, but it might require more effort to get your code to run under it.
Please give us more information about your application. Simple commandline utility? Uses KDE libraries? Uses linux kernel extensions? etc etc. For internal use only? For use on corporate desktops? For use by end-users? These all will change our suggestions.
I'll also suggest using MinGW.
The basic process of porting:
Install MinGW and MSYS
Run your Makefile.
Likely you'll get an error, fix it (either by changing code or by commenting it out)
Recompile via Makefile.
Repeat 2-4 until you compile with no errors.
Then test your application, and track down any bugs you might have introduced.
I am by no means an expert. Saying that, if you're not going to release your application, I believe you can use it with GPL'd stuff internally. It is only when you started distributing your binaries that you are bound by the GPL to release your source along with the binary, or by user request. E.g. a company could modify some GPL'd source code, and use it internally so long as they don't distribute the code or application outside of the company.
So it depends on what you plan to do with your app.
You might be able to use cygwin for now just to get it to a working point, and then gradually replace pieces of the app with native windows code until you've completely de-cygwin'd it.
I know that's probably not what you're looking form, but I thought I'd throw that out there. They should have a couple law/licensing classes shoved into CS degrees these days.
There is also a commercial license for Cygwin.
http://www.redhat.com/services/custom/cygwin/

better command for Windows? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Improve this question
While I grew up using MSWindows, I transitioned to my much-loved Mac years ago. I don't want to start a flame war here on operating systems. I do, however, want a terminal a litle closer to what I'm used to.
I'm not asking for full POSIX support - I don't have the patience to install Cygwin - but I miss tabbed terminals, being able to easily cut and paste, and my good friends ls, mkdir, rm, et al. (For these last ones, I could always put .bat files on my path, but that's going to get old fast.)
Anybody have a terminal application for MSWindows XP ?
I'm using powershell, its awesome to keep you from going crazy, and it has rm and mkdir and ls.
Tabbed terminals is still not in powershell, and copy paste is similar to cmd, but its way better than cmd.exe.
Some more options:
MSYS: a Minimal SYStem providing a POSIX compatible Bourne shell environment, with a small collection of UNIX command line tools. Primarily developed as a means to execute the configure scripts and Makefiles used to build Open Source software, but also useful as a general purpose command line interface to replace Windows cmd.exe.
GNU utilities for Win32: ports of common GNU utilities to native Win32. In this context, native means the executables do only depend on the Microsoft C-runtime (msvcrt.dll) and not an emulation layer like that provided by Cygwin tools.
PowerCmd is great, with a ton of features including tabs, cut/copy/past, etc.
Console is also a great replacement and is a bit more stripped down than PowerCmd (which can sometimes be a little too feature rich.
Also, with both of these, if you have powershell installed, it is possible to run powershell from withing either.
If you are a bit of a Pythonista then iPython is tough to beat. It has some of the more common shell commands coded in (i.e. ls, pwd, cd etc.), can also run any other shell command by prefixing with '!' (i.e. !latex file.tex) but also is a full Python shell with history, tab-complete, multiline editor support, logging etc. etc.
Moreover, you can install iPython back on your UNIX boxes as well as Windows meaning your environment can follow wherever you go.
There is a new-ish open source Console Emulator called cmder. It looks really nice and has some advanced features that make it nicer to use. You can also use powershell with it. Best of all, it's portable!
I've never found anything I like more than Cygwin.
I also went ahead and installed Cygwin/X w/ Openbox so I can get something like this:
It's got multiple workspaces inside the main Openbox window so I can easily have up to 20 non-overlapping xterms that I can easily cycle through.
I know you said you don't want to install anything, but I strongly suggest you give Services For Unix a shot:
http://technet.microsoft.com/en-us/interopmigration/bb380242.aspx
I use Console with unxutils
Console for the tabs and easier to manage select/copy/paste
unxutils for ls, rm, grep, uniq, sort ... and other goodness.
PowerShell is amazing, however for anything other than the most basic commands there is a learning curve when switching from bash etc.
I went back to using cygwin.
PowerShell is worth looking into.

Resources