• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Web Hosting Resource Kit

Web Hosting, Web Hosting Reviews & Virtualization

  • Contact
  • About Us
  • Privacy Policy

This post may contain affiliate links. If you use these links to buy something we may earn a commission. Thanks.

The 10 most important Linux commands for beginners

June 29, 2020 By Christoph Puetz Leave a Comment

  • Tweet
  • Sumo
  • Tweet

This posting is providing a simple list of the 10 most important Linux commands for beginners.

Have you installed Linux for the first time and / or have you just switched from Windows 10 to Linux as your operating system of choice? And now you want to deal with the infamous Linux command line as your next challenge? Then I have exactly the right guide for you:

The ten most important Linux commands for beginners and those making the switch.

Every beginning is difficult. However, to make it easier for you to get started in the world of Linux commands aka Linux command line commands aka console commands, we have put together the ten most important Linux commands and related command line groups for beginners and those changing over to Linux. This guide will help you so that you don’t stumble upon your first steps with Linux.

Important: there are numerous options and extensions for almost every of the commands presented here. We only offer a basic overview and do not present all options for each command.

Preparations: Open a terminal window

Open a terminal window on your Linux PC (also called command line window or shell or console). In Ubuntu with a Unity interface, enter “xterm” in the dashboard (which you open by clicking on the Ubuntu icon in the top left) and then start Xterm with a simple mouse click. Alternatively, press the key combination CTRL + ALT + T (for other Linux distributions or desktop interfaces, use the corresponding key combinations or menu items). The standard relatively small Xterm window can be enlarged at any time with the mouse pointer

After opening, you will see the white cursor behind the command prompt (by default this consists of your user name before @ and the computer name after @. You can change the composition of the command prompt in the configuration file of your Linux system). Enter the Linux commands after this prompt.

Tip: Use the key combination CTRL + C to cancel an output in the terminal window. This helps, for example, when a (faulty) command continuously only delivers garbage. In our example, we have shown an image file with cat (you can use the cat file name command to display the content of simple text files, cat is only suitable for short files), which led to a less meaningful result.

  1. Clear: Clean up the input window

After countless entries you have lost the overview and simply want to have the input window nice and empty again: Type in “clear”. Alternative: CTRL + L.

  1. Whoami – who am I – and who

Are you unsure of what your user name is under which you are logged in ?: “whoami” provides the answer (alternatively you can also enter “who -m”. Whoami makes sense especially if you are often between different users or root switch back and forth and the user name is not displayed in the command prompt.

Whoami should not be confused with the “who”, which is also useful – it delivers all users currently logged on to your Linux system. After entering who, you can see which user has logged on to which device, on which day and at what time. With “who -a” you force a detailed output, for example by specifying the login time. An alternative to who is the id command.

Extra tip: Use the “last” command to see who was last logged on.

  1. pwd: Where am I?

You have lost your bearings and no longer know which directory you are in. The bash command “pwd” helps and shows your current directory.

  1. df: Show file system and storage space

The command “df” shows the file system including the memory allocation. For example, you can see at a glance how many hard drives are in your Linux PC and how much space is still free on them. You can also see how each drive is mounted in the directory hierarchy. To increase the readability of the output, you should always type in “df” with the parameter “-h”, ie “df -h”: Then the storage space is displayed in Mbyte or Gbyte and not in bytes. With “df -T” the command in turn names the file system for each partition and data carrier.

If you enter df together with the name of a directory, you will only see the data of the partition in which the directory is located.

  1. Passwd: Change password

Even the most secure password should be changed from time to time. And especially change a password preset by the manufacturer into your own password. So enter “passwd”. Linux then asks you to enter your previous password (referred to as Unix password in our example). The entry is invisible. Then you will be asked to enter a new password. Repeat this again – both entries are also made invisible. Your new password already applies (please do not write it down on a Post-it and stick it on the screen).

Console arts: brilliant tricks for the shell
Warning: Linux distinguishes between upper and lower case. Numbers and hyphens and underscores are allowed, but commas or semicolons are not.

By the way: Linux stores the passwords encrypted in the / etc / shadow file.

With normal user rights you can only change your own password with passwd. With root rights you can also change the passwords of all other users: “passwd username” is the command for this. However, the old password no longer has to be specified here. Root can deactivate an account with “passwd – l” (l stands for lock). The reactivation is done with “passwd -u” (u stands for unlock).

  1. ls: Show directory

With “ls” you can display all files and directories in the directory in which you are currently located. In our example (an Ubuntu system), directories are marked in blue, but files in white. You can switch to any directory displayed with the “cd” command (see below). Hidden files and directories are preceded by a “.”

If you want to know more detailed information about the existing files and directories, enter “ls –al”. Then Linux provides you with the file type for each file and directory (for example “-” for files, “d” for directory) information on access rights, the number of hard links (which refer to the file), the owner of a file and for group membership, file size (in bytes) and the last modification date with time and finally the file or directory name. The option “a” (for “all”) also ensures that system directories are also displayed. The “l” (for long) provides detailed, long output, with each file and directory on its own line.

  1. cd: change directory

With “cd ..” you switch to the next higher directory. If you have got an overview of the existing directories with “ls”, you can switch to each directory with cd DIRECTORY NAME /. You have to pay attention to the exact spelling of the directory name. However, the tab key makes input easier: just type in the first letter or letters of the desired directory name and then press the TAB key to let Linux complete the name.

Linux for every purpose and every user – the great overview
The command cd without parameters lets you switch to your home directory.

Important: In addition to relative paths (which you enter depending on your current “location” in the directory hierarchy), you can also enter absolute paths: You always enter these starting from the root directory, for example: cd / home / Username /Documents.

  1. cp: copy and rename

With “cp” you can copy files and entire directories in one go. An example of copying a single file to another directory: “cp file name of target directory”. If you enter a name that does not yet exist instead of the target directory, the file will be renamed.

Five reasons against Linux – that’s why the upgrade fails

With “cp –r source directory target directory” you copy a complete directory including the hidden files and the subdirectories.

  1. rm: delete files

With “rm” you first delete only files. rm *. ~ deletes all backup files in the current directory.
Directories are only deleted with “rm” if you put the option “-r” behind them. The “r” stands for “recursive”: All directories and files are then deleted downwards from the user’s entry location. And even directories, if they still contain files or other directories and are therefore not empty.

This deletion is done on some systems with a query, but on others without further query, so you can easily accidentally move important files and directories to Nirvana.

Attention: With the command “rm -r f” you sweep all files and directories downwards from your location from the hard disk, specifically without the Linux system asking you again. The “f” stands for “force”: Read-only files are also deleted without confirmation.

If you enter this command at the top level, ie with root alias “/”, you will delete your entire Linux system if you are logged in as root. But even if you enter this command as a normal user, you will at least destroy all files and directories that belong to you.

If you want to delete files with special characters in their file names, you must put the special characters between single apostrophes, for example: rm ‘#’ * deletes all files in the directory that begin with #.

  1. Cat: Quickly view or create a text file

Do you want to quickly view the content of a text file? Then type in “cat filename”. The terminal window then shows you the content of the text file. In the case of text formats that contain complex formatting characters and control characters, the output is sometimes confusing. For a first overview, the output of cat can be sufficient and simple txt files can even be displayed perfectly.

You can create a short note in simple text format by not having the standard input from the keyboard output on the screen, but by redirecting it to a file: “cat> new file”. Where you replace new file with the desired file name. As soon as you have entered this command and pressed RETURN, the terminal waits for your text. Type it in as you like, line breaks can be done with RETURN. When you are finished typing, type CTRL + D. This concludes the input, the creation of the text file is ended. Now enter ls as a control. You will now find the new first text file in the directory. With cat filename you display their content.

You can also combine several text files with cat. With this command, you can combine the three text files from our screenshot, namely new_notes, notes and sticky notes into a single file: cat new_notes notes notepad> end notes.

Related posts:

  1. Linux Tutorial: How to change the IP ADDRESS on a Linux machine
  2. Automating Tasks in Linux using Cron
  3. Linux Runlevels
  4. What is .htaccess and how is it being used?
  5. How to Secure your Dedicated Server (RedHat Linux + Cpanel)
  6. Linux Server Load Averages Explained
  7. How to write a cron job?

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Categories

  • Business Management
  • Editors Column
  • Hosting Customers
  • Interviews & PR
  • Marketing/Advertising
  • Online Marketing/SEO
  • VMWare
  • Web Host Startup
  • Web Hosting
  • Web Hosting Reviews

Pages

  • About Us
  • Contact
  • Disclosure Policy
  • Privacy Policy
  • Sitemap
  • Terms of Service
  • Welcome to Web Hosting Resource Kit

Copyright Webhostingresourcekit.com© 2022 · Log in