Complete linux commands pdf

Top 25 Basic Linux Commands for Beginners [Recommended]

Linux is a powerful operating system that is pervasively used today, even though it might not be apparent to you. Data from TOP500 shows that Linux powers 100% of the world’s top 500 supercomputers, which is an astonishing statistic.

Linux is so ubiquitous that it is present in cell phones, cars, refrigerators, and Roku devices. It runs most of the Internet and several supercomputers. In fact, stock exchanges across the world in several countries run on Linux.

The reason Linux is so popular is that it is one of the most reliable, secure, and robust operating systems available. Here, we list and explain some important basic Linux commands so you can learn how to use Linux with ease.

Click here to download Hackr.io’s free Basic Linux Commands PDF.

Basic Linux Commands

We’ve listed 25 of the most common Linux commands here. They’re not all you need to know, but they are some of the most common. And remember, Linux commands are case-sensitive.

1. ls

This command lists directory contents. If you’ve used the Windows command prompt, then you should know that the command dir is used to list the contents in a directory. This is what the ls command does in Linux — it lists files and directories. Some versions may support color-coding. The names in blue represent the names of directories.

The command ls -l | more – helps paginate the output so you can view page by page. Otherwise the listing scrolls down rapidly. You can always use ctrl + c to return to the command line.

2. cd /var/log

This changes the current directory. Note that it uses a forward slash. The example used here changes the location to a Linux directory that is present in all versions of Linux.

When you usels –I you will be able to see more details of the contents in the directory. It lists the following:

  • Permissions associated with the file
  • The owner of the file
  • The group associated with the file
  • The size of the file
  • The timestamp
  • The name of the file

3. grep

This finds text in a file. The grep command searches through many files at a time to find a piece of text you are looking for.

Читайте также:  Write iso to usb flash linux

grep failed transaction.log

The above command will find all of the words in the files that matched the word ‘failed’.

$ grep ‘failed’ transaction.log

learn the command line linux

Recommended Course To Master Linux Commands

4. su / sudo command

There are some commands that need elevated rights to run on a Linux system. You must run these as a System Administrator.

The su command changes the shell so that it is used as a super user. Until you use the exit command, you can continue to be the super user.

The sudo command is used when you just need to run something as a super user, you can use the sudo command. This will allow you to run the command in elevated rights and once the command is executed you will be back to your normal rights and permissions.

An example is the shutdown command, which turns off the computer system.

  • sudo shutdown 2:shutdown and turns of the computer after 2 minutes.
  • sudo shutdown –r 2: shuts down and reboots in 2 minutes.
  • Using ctrl Cor shutdown–c: helps in stopping the shutdown process.
$ sudo shutdown 2 $ sudo shutdown –r 2

5. pwd

One way to identify the directory you are working in is the pwd command. It displays the current working directory path and is useful when directory changes are made frequently.

6. passwd

Though it looks similar to the pwd command, this command is very different. This command is used to change the user account password.

You could change your password or the password of other users. Note that the normal system users may only change their own password, while root may modify the password for any account.

passwd [username]— changes the password for the user.

7. mv

The mv command moves a file or renames it. Here the file name gets changed from first.txt to second.txt.

Type lsto view the change.

8. cp

This command copies a file. The cp command issues a copy of the file second.txt in the same directory.

You can use ls – lto see the new file created.

9. rm

This command is used to remove files in a directory or the directory itself. A directory cannot be removed if it is not empty.

rm –rremoves all the contents in a directory and the directory as well.

10. mkdir

The mkdir command makes a directory. The command is written as follows: mkdir [directory name]

11. chmod

This command changes the mode of a file system object. Files can have read, write, and execute permissions.

  • chmod mode FILE
  • chmod 744 script.sh
  • The first number stands for the user who is associated with the file
  • The second number is for the group associated with the file
  • The third number is associated with everyone else who is not a part of the user or group
Читайте также:  Переместить файл linux консоль

12. chown

This command is used to change the ownership of a file/folder or even multiple files/folders for a specified user/group.

chown owner_name file_name

Assume that if you are a user named user1and you want to change ownership to rootuse “sudo”.

13. cat

The catcommand (short for “concatenate”) is one of the most frequently used commands in Linux. catcommand allows you to create single or multiple files, view contents of files, concatenate files (combining files), and redirect output in terminal or files.

$ cat file.txt $ cat file1.txt file2.txt

The output will be the entire contents of the file(s).

14. echo

This command is used to display a text or a string to the standard output or a file.

$ echo “This is an article on basic linux commands”

The output would be “This is an article on basic linux commands”, without the quotes.

The echo –e option acts as an interpretation of escape characters that are back-slashed. \n the newline character is interpreted by the echo –e command.

$ echo –e “This is an article is for beginners. \nIt is on basic linux commands

The output of the command above would be:

This is an article is for beginners. It is on basic linux commands

15. wc

The wc(word count) command is used to find out the number of new lines, word count, byte, and characters count in a file specified by the file arguments.

Shows the output as — 120 readme.txt

  • wc -l : Prints the number of lines in a file.
  • wc -w: Prints the number of words in a file.
  • wc -c : Displays the count of bytes in a file.
  • wc -m: Prints the count of characters from a file.
  • wc -L: Prints only the length of the longest line in a file.

16. man

This command is used to view the online reference manual pages for commands/programs.

This command is used to show previously used commands or obtain information about the commands executed by a user.

18. clear

This command clears the terminal screen.

19. apt –get

apt -get is a powerful and free front-end package manager for Debian/Ubuntu systems. It is used to install new software packages, remove available software packages, upgrade existing software packages as well as upgrade the entire operating system. apt – stands for advanced packaging tool.

20. reboot

This command halts, powers off, or reboots a system.

21. locate

The locate command is used to find a file and runs in the background, unlike the find command.

22. diff

The diffcommand compares two files line by line to find differences. The output will be the lines that are different.

23. useradd

The useraddcommand creates a new user. The username is added after the useradd command, as follows:

24. exit

The exit command exits the current shell. When you hit enter, you’ll be taken out of the terminal.

Читайте также:  Linux utf to ansi

25. kill

The kill command is used to end a process, usually an unresponsive one. The kill command also includes the process ID or the program name, as shown here:

Conclusion

We hope this Linux commands list will help you get started. These are just a few commands — there are many more that you’ll find yourself using over time, but this is a good starting point. The best way to learn Linux is by trying these commands yourself and also by taking course. Below we list the best Linux courses you can take today!

Frequently Asked Questions

1. How Do I Get a List of All Commands in Linux?

Type compgen -c to get a list of all commands that you can run. You’ll see the list of commands one after the other.

2. What is a Linux Shell/Terminal?

A Linux Shell, or terminal, is the command interpreter which lets you run operating system services and tasks. It is an interface for Unix systems that helps you run programs, among other things. It is a powerful feature, and in Linux, bash is the most commonly used shell.

3. What are Shell Commands?

A shell is the command interpreter in Linux. By entering certain Linux terminal commands, you can perform specific tasks and work with operating system services.

4. How Do You Write Commands in Linux?

To write commands in Linux, you first need to open up the Linux terminal. You then simply type in the commands, many of which are explained above

5. How Do I Learn Basic Linux Commands?

Basic Linux commands are quite easy to grasp, and are explained in the list above, which covers just about all Linux commands for beginners. They aren’t very complicated and using them will quickly become second nature.

People are also reading:

Источник

Complete linux commands pdf

The Linux Commands Handbook

Pages : 135
Size : 14.2 MB
File type : PDF
Downloads: 679
Created: 2022-02-03
License: Open Publication License
Author(s): Flavio Copes

This book introduces Microsoft Power BI basics through a practical, scenario-based guided . download free Microsoft Power BI tutorial in PDF (351 pages) created by .

Modern appliances are complex machines with processors, operating systems, and application. download free Linux tutorial in PDF (356 pages) created by Bob Smith .

Download free course Introducing Windows Server 2016, pdf file on 181 pages by John McCabe.

Linux systems are everywhere today, even in companies once considered «pure Windows.» If you’re a sysadmin, network administrator, or developer in a small Windows shop, you may have to jump in and fix a system problem when your site goes down. What if you have no Linux knowledge? This short guide .

this book offers a hands-on approach to learning by encouraging readers to follow along on a working Linux computer.Each command is explained in detail, allowing you to practice and apply what you’ve learned immediately.

Источник

Оцените статью
Adblock
detector