0

This question already has an answer here:

I come from the windows world trying to switch to Linux. Sorry for the naïve question but is there something like "common Linux commands"?

For example in Windows, the command line is pretty limited, but it is common between all windows. So if you know what the dir or mkdir command does and what switches it takes, you can use any version of Windows and be sure that your BATCH files work.

In Linux however, if I understand correctly there are many ways to do the same thing. For example for editing files you may use EMACS or VIM. Even the shells have a wide variety (is bash the de facto standard?)

From what I understand so far, the command line is way more flexible (and versatile) than Windows CMD. Something like Busybox promises to pack a whole lot of commands in one project. Anyway, this is all too overwhelming, so I was wondering if there is a small set of Linux commands that are common between all systems and I can carry on my daily tasks on every Linux machine regardless of its distro.

marked as duplicate by Mikel, PersianGulf, Anthon, Stephen Kitt, chaos May 15 '15 at 5:44

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Just about every Unix/Linux system uses a similar set of command line utilities. There are variations but awareness of these comes over time. IME System Administration tools vary the most. – roaima May 15 '15 at 0:54
  • Very similar to unix.stackexchange.com/questions/3380/… which didn't get great answers. – Bruce Ediger May 15 '15 at 3:53
1

The beautiful thing about *nix, and open source in general, is that you have no shortage of resources. Most *nix CLIs will behave similarly, though there are outliers. Don't worry about them for now. Get BASH figured out. It'll be your interpreter 99% of the time. Learn vim, and know right now that most distro's only include vim-tiny, so install the package 'vim' as soon as the cli lands.

// Here's a good cheat sheet. There are many others, just search "BASH Cheat Sheet"

https://github.com/NisreenFarhoud/Bash-Cheatsheet

// Here's the comprehensive beginners guide. Very much worth reading.

http://www.tldp.org/LDP/Bash-Beginners-Guide/html/Bash-Beginners-Guide.html

// Read the Components section

http://en.wikipedia.org/wiki/Unix

Once you get used to the basics, checkout some other people's bash shell scripts. No Starch Press's Wicked Cool BASH Scripts is a good read. Here's one more.

http://www.commandlinefu.com/

This one's mine:

find ~/ -mtime $(echo $(date +%s) - $(date +%s -d"Dec 31, 2009 23:59:59") | bc -l | awk '{print $1 / 86400}' | bc -l)
2

This list of the most useful commands and a brief explanation about each one of them would get you started. This list is not tied to any distro box either which is pretty useful.

http://ss64.com/bash/

2

Sure, there are “common Linux commands”, but I doubt that you'll find statistics as to which ones are used most often on average, and different people use different commands. There is no authority who will say “this command is common, this one is not”.

There are commands that are standard across Unix-like operating systems, defined by POSIX. However standard is not the same as common. Some commands get standard by the virtue of having existed for a long time and having been included by many vendors. Commands such as compress and tsort are standard, but you may well never use them — compress has been superseded by better compression utilities such as gzip, and tsort is a fairly obscure functionality. On the other hands, commands such as mount are de facto standard, but not de jure, because the way they operate varies too much. And there are commands like bash itself for which only one implementation exists and that are very common.

Non-embedded Linux systems, as well as Cygwin, come with GNU coreutils. This is the package that provides basic commands like ls, mkdir, etc. (and tsort). The util-linux package is also pretty much universal across non-embedded Linux systems. BusyBox is a set of utilities that covers the same ground as GNU coreutils and util-linux, but with reduced functionality, for embedded systems.

There is no definitive list of common commands, but there are many books and tutorials about the Linux command line. I suggest that you read a few of them, little by little. And of course, when you need to do something, go and look for the command(s) that can accomplish this task. In addition to web search engines, you might find the apropos command useful — for example, if you want to copy a file, you can run apropos -s 1 copy and it displays a list of commands whose short description includes the word “copy”. As apropos both includes a lot of false positives (“copy ID3 tags”, “system-to-system copy”, …) and can miss commands because their description used a different formulation, you'll often have better results with a web search engine which attempts to rank results by relevance and popularity.

I will offer a short list of useful commands. This is by no means an exhaustive list, nor even a list of the commands you'll use the most often, but they are common tasks and it's very useful to know them.

  • grep — search in text files
  • less — view the content of a text file
  • locate — find a file based on its name, when you don't know in which directory it is
  • ls — list files in the current directory
  • man — view the documentation of a command
  • xdg-open — open a document, like clicking in a file manager
  • May I suggest also adding find to the list of essential utilities. :) – lcd047 May 15 '15 at 4:49

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