16 ms·
Learn just enough Linux to get things done
- frabbit 9y agoIn place of the "tabview" command (which is a non-standard, pip-installed program) a simple "column -t" would be less trouble for most users.
- otterpro 9y agoThanks. I was looking for tabview but it wasn't easy to find, and in python (not that it's bad, but it wasn't a native tool). Rather, column -t is definitely a better choice, since it is a native posix tool.
- jwilk 9y agocolumn(1) is not in POSIX. It originates from BSD, but it's also part of util-linux, so it should be available on most Linux distros.
- reacweb 9y agoIn my project, I maintain 3 documents. The first one is a similar list of basic linux knowledge that people should learn when arriving on the project. The second is "UnixTipsAndPitfalls" where people should add new entries when they encounter usefull commands. The third one is about tar.
- needz 9y agoYou should make github gists of these.
- ivanhoe 9y agoOver years I've heard a lot of complains on tar being hard to use, but in real-life I really ever had to use only these two commands: tar zcvf and tar zxvf. It's actually quite easy to remember: tar Zip Compress Verbose File, and tar Zip eXtract Verbose File.
- liveoneggs 9y agoadd 'tar r' and 'tar u' to your arsenal.
- emmelaich 9y agoIn about 40 years of using Unix I have never used r or u.
- liveoneggs 9y agoboth seem fairly important in the 40-years-ago world concerning the 't'(ape) part of tar but okay. I use them frequently as an "rsync"-ish into the archive file, which I can then use to take point-in-time snapshot/backups.
- reacweb 9y agoYes. I also suggest to use tar instead of the dangerous cp -r: tar c -C src . | tar x -C dst. It works over ssh connections (ssh -C for compression) and is a good training of tar syntax.
- AstralStorm 9y agoIt is also quite slow. For such moves rsync works much better.
- nerdponx 9y agoIt's even easier than that! Less memorization, more understanding. You can think of Tar arguments as either subcommands or options. The dashes are optional The "subcommands" are x (extract), c (create), t (list), among others. The "options" are f (read from named file rather than stdin), v (verbose mode), and z (run gzip on the archive before processing). The fact that these options can be written without leading dashes, and all smashed together in a single argument, is legacy silliness for saving a few keystrokes. Don't confuse yourself with it, and don't confuse other people by teaching it to them, instead of teaching them how to actually use the command (which is really not hard at all). So when I write Tar commands, I like to think along these lines. Instead of "tar zcvf foo.tar.gz", I write "tar -c -zv -f foo.tar.gz". After doing that about 3 times, it all sank in. Nowadays I'm much more intimidated by Git than Tar. In the version of tar on the machine I'm posting from (GNU tar 1.27.1), this structure is obvious from right there in the man page: SYNOPSIS Traditional usage tar {A|c|d|r|t|u|x}[GnSkUWOmpsMBiajJzZhPlRvwo] [ARG...] UNIX-style usage tar -A [OPTIONS] ARCHIVE ARCHIVE tar -c [-f ARCHIVE] [OPTIONS] [FILE...] tar -d [-f ARCHIVE] [OPTIONS] [FILE...] tar -t [-f ARCHIVE] [OPTIONS] [MEMBER...] tar -r [-f ARCHIVE] [OPTIONS] [FILE...] tar -u [-f ARCHIVE] [OPTIONS] [FILE...] tar -x [-f ARCHIVE] [OPTIONS] [MEMBER...]
- Sean1708 9y ago> The third one is about tar. Why do people have such a difficult time with tar? The only tar commands I've ever needed (or seen other people need) are `tar cf ...` or `tar xf ...` (occasionally I'll need to chuck a z in there if the file is/needs to be gzipped), are other people just using far more complex tar commands than I am?
- eitland 9y agoBecause people assume they should RTM and if memory serves me right it is a whole lot more confusing than your post :-)
- Sean1708 9y agoDoesn't look any more complex than most man pages: https://linux.die.net/man/1/tar https://linux.die.net/man/1/tar
- eitland 9y agoPart of my point: most of them are complex and to a big degree unnecessarily complex.
- michrassena 9y agoI agree and wish distro maintainers could make some changes. I would love to use manual pages, but instead I search the Internet first. If every manual had a section with most-common examples, it would help immensely. You could just type 'manexamples tar' and it would print out tar cvf somedir filename.tar create an archive from somedir and store it in filename.tar tar xvpf filename.tar extract the contents of filename.tar and scatter them around your home directory Instead of getting examples that I might use, when I visit a man page, I get a wall of text 926 lines long, describing every possible option, including GNU option styles, or some truncated mess telling me to read the info pages. Of course, it's appropriate that all this information is included somewhere in the manual. I just think the common use cases should be first. Does anyone need a man page for 'ls' that starts off describing how to list inode numbers and SELinux labels?
- misterioss 9y agohttps://github.com/jlevy/the-art-of-command-line https://github.com/jlevy/the-art-of-command-line
- plupf 9y agohttps://linuxjourney.com/ https://linuxjourney.com/
- mediocrejoker 9y agohttps://www.learnenough.com/command-line-tutorial https://www.learnenough.com/command-line-tutorial
- carlosrg 9y agoThis article should be named "Learn just enough Unix to get things done". Almost everything explained can be done on any Unix-like system like macOS and it's not exclusive to Linux.
- eitland 9y agoDisagree. It could be mentioned early in the article. However for its target audience (I assume) that would be far less useful. ("This looks great but seems to be about Unix and I know this is a Linux thing.")
- ChiliDogSwirl 9y agoMost of it applies to any posix-ish shell, even on non-unices. And you can get quite a bit done on Linux without knowing any of it.
- indescions_2017 9y agoGreat list for starters. But getting real work done requires much more. Having just walked through some basic steps with a novice, I can concur, modern linux is impossible without "recipes". Just setting up a hello world web app can involve: ssh login to running instance, using curl to download the gcloud sdk, tar to unpack, sudo to install, systemctl to start local processes, useradd dedicated www, chmod and chroot to allow access, rsync to tranfer files, netcat to manage ports, etc. For beginners, without a trusted hand to guide them, its beyond intimidating. These systems must become more accessible to the average human.
- jmiserez 9y ago>These systems must become more accessible to the average human. I disagree. Firstly, all the commands you mentioned are pretty simple to understand given that they have a manpage and lots of help available online. Secondly, not everything needs to dumbed down for the average user. A large part of the power comes from all the tools and flags available and the combination possibilities. Dumbed down tools are limiting and frustrating. I’d expect any software engineer worth their salt to not be an “average user” and grasp a few simple commands the same way they approach a new project or programming language, i.e. they should be able to pick up the basics even if it’s a complex system. That’s a prerequisite for programming and understanding a project’s code well anyways.
- tachion 9y ago"Well" is the keyword here. They don't, far too often "good enough if it doesn't crash the machine on start" is a norm in companies of all sizes when writing applications code and infrastructure code.
- eitland 9y agoProblem is, as I've already mentioned elsewhere, that the manpages do a pretty poor job in a number of places. Yes, I do use them but I guess most Linux users learned most of what they use from colleagues and Internet, not the official documentation.
- deleted 9y ago[deleted]
- AlexB138 9y agoMentioning strace in an article titled "Learn just enough Linux to get things done" seems so out of place as to be absurd, even in an "Advanced" section. Anyone who needs the rest of this advice is going to be absolutely baffled by strace. Otherwise, decent little primer.
- kirk781 9y agoEven 'netstat | head -n20' is out of place for introductory Linux.
- mediocrejoker 9y agoAlso curious was the inclusion of pushd/popd without explaining what a 'stack' is
- throwaway7645 9y agoNot sure bout netstat, but I pipe text to | head and use the -n flag to specify # of lines all the time.
- jjrh 9y agoI'd tend to agree, but I think it really depends on what the person is doing/what the end goal is.
- luord 9y agoI've been a linux user for almost eleven years now, and a professional software developer for four, and I wasn't even aware that strace existed until just now.
- laresistance 9y agoI've been tinkering on Linux as a hobby for about 2 years now and was made aware of strace a couple of months after starting to dig a bit deeper. You make me hopeful of my future employment.
- 9y ago
- yoran 9y agoOne example of this is the popular version control system (VCS) called git. Developers could have written this software to work on Windows, but they didn't. They wrote it to work on the command line for Linux because it was the ecosystem which already had all the tools they needed. I think the real (and even stronger) reason is that Linus Torvalds specifically built Git to serve as the VCS for the Linux codebase.
- lucideer 9y agoThat and the fact that Mercurial worked on Windows renders this line very poorly researched. Then again, perhaps the author, like the title, learned just enough to write the article.
- BeetleB 9y ago>I think the real (and even stronger) reason is that Linus Torvalds specifically built Git to serve as the VCS for the Linux codebase. Mercurial was built for exactly the same reason (VCS for Linux), at the same time. Yet it has always been cross-platform. Linus wrote it for Linux because he didn't care about whether it would work in Windows. No other reason.
- jmiserez 9y agoAnd who could fault him for that. After all, why would he care or even want to invest time to make it run on Windows? It’s GPL, anyone can port it if they want to. Git for Windows and Cygwin Git have some issues (I use them daily at work), but many of these can be entirely attributed to the limitations of Windows: CRLF, case-insensitivity in filesystems, problems with long pathnames, slow process forking, etc.
- vinniejames 9y agoYes, he has said this in interviews. Great write up! I too keep a list of helpful commands handy: https://github.com/vinniejames/koopa-troopa https://github.com/vinniejames/koopa-troopa adding a link to yours
- recursive 9y ago
- SaltyBackendGuy 9y agoAnd not even one mention of man pages... That is was my main resource for learning new (remembering old) commands. Maybe it's out of date now due to google, but if you're already in the terminal man is the way to go. Also, I feel like cat and less should have separate explanations as they have diverging utilities.
- OlliDus 9y agoWhait! There is one mention of man in this article: "The only way to learn what these mean is to look them up through Google or by typing 'man grep'. "
- SquareWheel 9y agoThere's two mentions of man pages.
- SaltyBackendGuy 9y ago<Apologize> I missed in my initial skim
- dsfyu404ed 9y agoLearn Just Enough Linux To Make QA, Ops, Security Hate You. Learning to do a thing and learning to do a thing well enough to create a production quality result that isn't a liability to the company are very different. That said, improving Linux knowledge among those who had little/none before is a net win in the long term IMO.
- Finnucane 9y ago>Learn Just Enough Linux To Make QA, Ops, Security Hate You. Hey, that's me!
- grx 9y agoThis is not a surprise - the Windows ecosystem simply wasn't designed with software development in mind. Aha? What is C# and Visual Studio? Or .NET? Was Linux designed for software development? This article is so bad, I'm really getting mad over here. Stop publishing such crap, you feed a lot of people's resentment against all those hipster developers who don't want to learn by RTFM, but want to have handled everything. Articles like this are a real hurdle on the way towards making Linux and programming in general more approachable to non-techies. Just stop, please.
- ajross 9y ago> Was Linux designed for software development? Linux was designed to emulate Unix and run the pre-existing Unix-like userspace from GNU. And absolutely yes, Unix was "designed" for software development. That's exactly what it was in its early days: a hacker playground for the geeks at Bell Labs to try new ways of doing things. And windows wasn't. Early windows development (for years after it became popular) was done at a DOS command line. Eventually Visual C++ because the dominant product, and certainly you can't say it wasn't innovative. But it remained a separate product. "Windows" wasn't for development. And we still suffer from this in, say, the way windows basics (like the standard C runtime!) typically need to be shipped per-app and are only vaguely compatible across OS and toolchain changes.
- vvanders 9y ago> Early windows development (for years after it became popular) was done at a DOS command line ... I could just as easily flip this and claim that Linux development is all backwards because it's still done on the command line. Given Microsoft's commitment to tooling, backwards compatibility and extensive documentation I think it's pretty lame to try and paint windows as not targeted towards developers. The difference is that windows has actual users, as opposed to the eternal horizon of "the year of linux on the desktop".
- deleted 9y ago[deleted]
- davexunit 9y agoLearn just enough GNU coreutils and bash to get things done.
- thomastjeffery 9y agoLearn enough literally every modern OS that isn't Windows to get things done.
- dahart 9y agoI’ve always felt there are two different kinds of Unix/Linux: sysadmin vs user. While Linux distros have been getting better and easier for many years, installing and maintaining Linux on my own machine still requires sysadmin Linux knowledge to this day. I personally believe this is why Macs have been so popular since OSX, it’s really the only machine out there that comes with Unix but doesn’t require any sysadmin knowledge to use productively. As soon as Linux truly reaches that same point where users can install and maintain it without needing sysadmin Linux, I think it could take over Mac’s position. And I wish it would, OSX seems to stuck in old version limbo.
- wutbrodo 9y ago> While Linux distros have been getting better and easier for many years, installing and maintaining Linux on my own machine still requires sysadmin Linux knowledge to this day. I'm not sure that's true. You can buy a few computers (including from Dell) with Linux pre-installed, and maintenance doesn't take a lot more than clicking on the upgrade button with the daily update-manager prompt. I _do_ have sysadmin knowledge and find the shell more efficient than the GUI in 99% of everyday-use cases (I can't remember the last time I opened a file browser). So it's entirely possible that there's some day-to-day work required that I'm not even thinking about. But my dad is running a Linux Mint system and I switched him to it (about ~10 years ago) because it required so much _less_ maintenance than running a Windows machine did. The number of phone calls for tech support I got from him plummeted from twice a week to zero when I switched him from Windows: I did so because I got tired of fielding constant questions about antivirus software, defragmentation, startup programs littering his systray, possible viruses installed, etc etc etc etc. It's really beyond me why anybody thinks that Windows is an appropriate OS for a non-technical user (er, or for a technical user, or really anyone who doesn't need specialty software).
- dahart 9y agoGood point that some people are there already, I agree with that. I’m not though, and I give it a shot about once a year to see what’s new. I’m curious if your dad installs much software? As a developer myself, I should have more sysadmin Linux under my belt, I’m happy to get very technical and nitty gritty with my own work. But I lose patience if my OS wants me to learn super arcane things for stuff that should just work and does on other OSes. Display drivers, networking, installing new drives, this is the kind of stuff that seems to trip me up in Unix.
- lain 9y agoI don't think I could disagree more with having `man` at the bottom of the advanced/infrequently-used section. Learning how to read and search through the documentation that comes with the system is a very beneficial thing to learn how to do.
- Bartweiss 9y agoI think I agree with the placement. It's definitely a good skill, I wouldn't dispute that, but it really is advanced/infrequent by the standards set here. Historically that wasn't true, but Stack Overflow has made it vastly easier to answer simple questions ("Which 'ls' flag shows permissions? How about hidden files?") without ever using a man page. You can go a long time without ever touching that and not have problems, while jumping to man pages without experience tends to be an overwhelming jumble of flags and conditions. Which isn't to say it's low value! Learning Linux well beyond "good enough" is still an enormously worthwhile project. But I do think it's correct to say it's no longer an entry-level step.
- nasirmaziz 9y agoAnother pretentious thought leader spewing misconceptions.
- alexpetralia 9y agoHi everybody - author here. Surprised to see this on the front page. I agree with most of the feedback and criticism here. Hopefully some readers found it helpful regardless.
- emmelaich 9y agoIt's ... pretty OK :-). My points/suggestions... 1. I've never heard of tabview and it's not on MacOS or Fedora. 2. Add ctrl-D to your possible exits. It's actually more common than ctrl-C. 3. Some of those commands are not installed by default on many systems; e.g. htop or dstat. And they require sdvanced knowledge to properly interpret. But they can be very useful. I'd suggest standard `top` and things like iostat instead.
- nixpulvis 9y agoThe key is the text stream. Both for computer interaction, and for communication in general. The rest are just names.
- alg_fun 9y agoThis article is about bash and not linux
- jheriko 9y ago> Basic tasks, like file parsing, job scheduling, and text search are more involved than running a command-line utility This seems backwards. Going to the command line for these things is a horrible workflow. It’s not necessary in Linuxes either ...
- mardiros 9y agoSomething is wrong. Quitting is ctrl+d Ctrl+c is for interrupting the current job. Some repl like the mysql cli does not rrspect that and it is a PITA