25 Common Linux Bash Script Examples to Get You Started
Bash or Bourne-again shell is one of the most popular shells and command languages for Linux VPS enthusiasts. It was first released in 1989 and was used as the default shell for most Linux distributions ever since.
Bash scripting allows users and system administrators to automate processes and save hundreds of hours of manual work. It’s worth mentioning that Bash is also available for Windows and macOS.
This tutorial will introduce you to what bash scripting is. It features over twenty useful bash script examples to start your bash scripting journey.
What Is Bash Scripting Used For
Before we move on to the topic of bash scripting use cases, we need to elaborate on what bash and bash scripting are.
Bash is a command-line interface interpreter that runs in a text window where users can manage and execute shell commands. Bash – or shell scripting – on the other hand is the process of writing a set of commands to be executed on a Linux system. A file that includes such instructions is called a bash script.
To put it simply, the bash interpreter reads the bash script and executes the commands at the same time. For example, a Linux user can execute hundreds of commands with a single click instead of inputting them one by one. For this reason, bash scripting is the go-to choice for increasing productivity, setting up automation, and eliminating repetitive tasks.
25 Bash Scripts Examples
The following section will cover 25 of the most popular bash scripting examples, including variable manipulation and echoing out various values. We will also cover functions, arrays, loops, and much more.
1. Hello World
Hello World is the most simple bash script to start with. We will create a new variable called learningbash and print out the words Hello World. First, open a new shell script file with a text editor of your choice:
Paste the following lines into it:
The first line (/bin/bash) is used in every bash script. It instructs the operating system to use a bash interpreter as a command interpreter.
2. Echo Command
The echo bash command can be used to print out text as well as values of variables. In the following example, we will showcase how quotation marks affect the echo command. We will start by opening a new bash script file:
This simple bash script example will create a new variable and print it out while using different quotation marks.
As you can see, if the echo bash command is used with double quotation marks ““, then the script will print out the actual value of a variable. Otherwise, if the single quotation marks ‘‘ are used, it will print out only the name of a variable.
3. Sleep Command
Sleep command halts all currently running bash scripts and puts the system to sleep. Start by creating a new bash script file:
Then, paste in the following simple script:
The above example starts with a simple sleep bash command that will put your system to sleep for 10 seconds. After that, we combine the previously learned echo command with sleep – this way system will sleep for 10 seconds, then print out some words, sleep again, print out some words again and end its operation.
Pro Tip
A bash script can always be terminated by clicking CTRL + C without waiting for it to finish its operation.
4. Wait Command
wait is a built-in Linux command that waits for completion of running process. The wait command is used with a particular process id or job id.
Here’s how to create a wait bash script. Begin by creating a new bash file:
Paste in the following:
Important! If no job ID is provided, the wait command waits until all child background jobs are completed.
5. Comments
Users can easily add comments to their bash scripts with the # symbol. It is extra useful if you’ve got a lengthy script that needs explaining on some lines.
Begin by creating a new bash script:
Then paste in the following:
Keep in mind that bash comments are only visible on a text editor.
6. Get User Input
To take input from users, we’ll use the read bash command. First, create a new bash shell file:
Then, fill it with the script below:
In the above example, an age value was entered by the user. The output was then printed via the echo command.
7. Loops
A loop is an essential tool in various programming languages. To put it simply, a bash loop is a set of instructions that are repeated until a user-specified condition is reached. Start by creating a loop bash program:
Then paste in the following:
This will work as a countdown to infinity until you press CTRL + C to stop the script.
Now that we’ve tested the while loop, we can move on to the for loop. Create a bash file for it:
It should contain the script below:
The script prints out numbers from 2 to 10 while adding the seconds keyword to it.
8. Create an Array
A bash array is a data structure designed to store information in an indexed way. It is extra useful if users need to store and retrieve thousands of pieces of data fast. What makes bash arrays special is that unlike any other programming language, they can store different types of elements. For example, you can use a bash array to store both strings and numbers.
Create a new file in the current directory:
Combine the freshly learned for loop with a new indexed array:
The script iterates over the IndexedArray and prints out all the values.
9. Conditional Statements
The most popular and widely used conditional statement is if. Even though the if statement is easy to write and understand, it can be used in advanced shell scripts as well.
Begin with a new bash file:
Paste the code below in it:
This script creates two new variables and compares whether they are equal or not.
10. Functions
A bash function is a set of commands that can be reused numerous times throughout a bash script. Create a new file:
Then, paste in the following code – it creates a simple Hello World function.
11. Display String Length
There are a couple of ways of counting string length in bash. We’ll talk about the simplest. Create a file named stringlength.sh:
Fill it with the following:
Here, the # operator is used to get the length of the string variable.
12. Extract String
If users need to remove unnecessary parts from strings, they can use the Bash string extraction tools. Start by creating a new bash script:
The following script has 4 values, 3 of them being strings. In our example, we will extract only the number value. This can be done via the cut command. First, we instruct the command that each variable is separated by a comma by using the -d flag. Then we ask the cut command to extract the 5th value.
In another example, we have a string that is mixed with some numbers. We will use expr substr commands to extract only the Hostinger text value.
13. Find and Replace String
Another useful bash script for strings is find and replace. Create a file named findreplace.sh:
Then paste in the following bash script:
The find and replace functionality doesn’t require any special commands, it can all be done with string manipulation.
14. Concatenate Strings
Concatenation is the term used for appending one string to the end of another string. Start by creating concatenation.sh file.
The most simple example would be the following:
The above script will connect the values of firststring and secondstring variables creating a whole new thirdstring.
A more advanced example would look like this:
The script uses the += operator to join the strings. With this method, you can concatenate strings with only one variable.
15. Check if a Number is Even or Odd
Odd and even numbers can be easily divided using the if statement and some simple math. Create a file named evenoddnumbers.sh:
The script uses the read command to read user input and divides it by 2. If the answer is 0, the number is even.
16. Generate Factorial of Number
The factorial of a number is the result of all positive descending integers. For example, the factorial of 5 would be 120:
Factorial scrips are very useful for users learning about recursion. Start by creating a .sh file executable:
The following script will ask the user to enter a number they want to get the factorial of and use a for loop to calculate it.
17. Create Directories
It is effortless to create directories in bash unless you need to create a lot of directories quickly. In the following example, we will use the bash script to create a set of directories with the same subdirectories in each.
First, create a file named directories.sh:
Then paste in the following code:
The script creates 4 main directories: Math, English, Geography, and Arts. The Notes, examresults, and portfolio subdirectories are also created inside each.
If you were to replace the / symbol in the middle with _, the script would look like this:
Here’s the output for it displaying a merge of the two directories:
18. Read Files
In order to read a file in bash, you will need to create a sample file first. Do so with the following command:
Fill it with some sample data:
Then create the actual script file:
Fill it with the following lines:
Running the script results in this output:
19. Print Files With Line Count
We’ll print a file with its line count. Let’s create it first:
In our example, we will fill it with our favorite car brands:
Save the file and create a new bash script:
Then paste in the following code:
The file contents of cars.txt match the printout of the while loop script.
20. Delete Files
To delete an existing file, you can use an if statement to check if the file exists and instruct the bash script to remove it. Start by creating the bash script file:
The following script will create a new file named cars.txt, and then – with the help of the if statement – check if it exists and delete it.
21. Test if File Exists
In order to check if a given file exists, users can perform conditional tests. In this case, we’ll use an if statement with a -f flag. The flag checks if a given file exists and is a regular file. Start by creating the script file:
Copy and paste the following script:
Running the script results in the following output:
22. Check Inodes and Disk Usage
Inodes represent data units on a physical or virtual server. Each text file, video, folder, HTML file, or script is 1 inode. We’ll check how many inodes there are in a directory, as too many can cause the system to slow down significantly. Start by creating the bash script:
Paste in the following code – it will check inodes in descending order as well as show disk usage in a given directory:
It will look something like this on the command line:
The given directory has 15 inodes and all files take up 20KB.
23. Send Email Example
It is possible to send mail via bash scripts as well. In order to do so, users first need a functional mail transport agent. On Ubuntu 20.04, the installation command will look like this:
Once you’ve taken care of the mail transport agent installation, create a new bash script:
Here are its contents:
Important! The above script is meant for testing purposes only as it won’t work normally with services like Gmail. We recommend using PHPMailer instead.
24. Update Packages
Keeping the system and all of its applications up to date is crucial. You can create a bash script to do it. Mind that this script requires root privileges. First, create the bash script file:
Fill it with these lines:
Make sure to preface the script with the sudo command when you run it:
Important!Apt package manager is used on Debian based distributions only. If you’re using a different distribution, make sure to update the command accordingly.
25. Show Server Information
The following script will list a few important server metrics: system’s date, uptime as well as memory, and network usage statistics. We’ll start by creating a new file for it:
Here’s the script for it:
Conclusion
Linux bash scripting is extremely useful for users looking to convert complex sequences of commands into one script effortlessly. Even if you are a casual user, you can make your life easier by automating simple tasks like updating packages or putting your system to sleep.
In this tutorial, we’ve covered the basics of bash scripting and how can it be used to automate tasks and increase productivity. We’ve also listed 25 of the most common simple bash scripts that you can try out.
We hope this article has helped you understand bash scripting better. You can also check out our bash scripting tutorial to learn more. If you have any questions or comments, leave them below.
Ignas takes great satisfaction in helping people tackle even the most complex technical issues. His current goal is to write easy-to-follow articles so that these issues will not happen at all. During his free time, Ignas likes to play video games and fix up things around his house.
How to write simple shell scripts in Linux
In this article, we will learn the most basic knowledge to program with bash script. Understanding them makes us strong into shell scripting.
Let’s get started.
Table of contents
Introduction to Shell
A Shell is a program that works between us and the Linux system, enabling us to enter commands for the OS to execute.
In Linux, the standard shell is bash — the GNU Bourne-Again SHell, from the GNU suite of tools, is installed in the /bin/sh. In the most Linux distributions, the program /bin/sh, the default shell, is actually a link to the program /bin/bash.
Belows are some shell programs that we can use.
Shell Name | history |
---|---|
sh (Bourne) | The original shell from early version of UNIX |
csh, tcsh, zsh | The C shell, and its derivatives, originally created by Bill Joy of Berkeley UNIX fame. The C Shell is probably the third most popular type of shell after bash and the Korn shell |
ksh, pdksh | The Korn shell and its public domain cousin. Written by David Korn, this is the default shell on many commercial UNIX versions. |
bash | The Linux staple shell from the GNU project. bash, or Bourne Again SHell, has the advantage that the source code is freely available, and even if it’s not currently running on our UNIX system, it has probably been ported to it. bash has many similarities to the Korn shell. |
Use different interpreter in script file
Use bash script
Use Python interpreter
The #! characters tell the system that the argument that follows on the line is the program to be used to execute this file.
#!/bin/bash or #!/usr/bin/python is known as hash bang, or shebang. Basically, it just tells the shell which interpreter to use to run the commands inside the script.
How to provide permission to run script file
To run our script file, there are two ways:
Invoke the shell with the name of the script file as a parameter
For example, /bin/sh hello-world.sh
Running our script file by calling its name
Before doing it, we need to change the file mode to make the file executable for all users by using the chmod command.
Then, we can run this script file by calling ./hello-world.sh .
Variables
The declaration of variables
In Linux, we do not need to declare variables in the shell before using them. The easiest way is that when we want to use them, create them such as assigning an initial value to them.
By default, all variables are stored as strings, even when they are assigned numeric values. The shell and some utilities will convert numeric strings to their values in order to operate on them as required.
Access their value
To get the the variables’s value, we insert $ symbol before their name.
A string must be surrounded with double quotes if it contain spaces.
The behavior of variables inside quotes depends on the type of quotes we use.
If we enclose a $ variable expression in double quotes, then it’s replaced with its value when the line is executed.
If we enclose it in single quotes, then no substitution takes place.
We can remove the special meaning of the $ symbol by prefacing it with a **.
Writing Shell Scripts — The Beginner’s Guide
Shell scripts are just set of commands that you write in a file and run them together. For anyone who has worked with DOS’s bat files, it’s almost the same concept. You just put a series of commands into a text file and run them together. The difference comes from the fact that bash scripts can do a lot more than batch files.
“A shell script is a computer program designed to be run by the Unix shell, a command-line interpreter. The various dialects of shell scripts are considered to be scripting languages. Typical operations performed by shell scripts include file manipulation, program execution, and printing text.”
Unix has more than one possible shell, and scripting any of them is a topic that can easily pack a complete book. In this post, I am going to cover the basic elements of a bash script.
Should I learn?
Agreed that anything you can do with a shell script, you can do that using some programming language such as Ruby, Python or Go but mostly for the small tasks, you will find yourself using Shell Scripts in one way or another.
Shell scripts are used to automate administrative tasks, encapsulate complex configuration details and get at the full power of the operating system. The ability to combine commands allows you to create new commands, thereby adding value to your operating system. Furthermore, combining a shell with graphical desktop environment allows you to get the best of both worlds
- Automate your daily tasks
- Create your own commands with optionally accepting input from the user
- Portability, executing the same script in your mac and your Linux based systems.
Writing Shell Scripts
Let’s start by a Hello World example. Open your favorite editor and write a shell script file named as my_script.sh containing following lines
The first line called a hashbang or shebang. It tells Unix that this script should be run through the /bin/bash shell. Second line is just the echo statement, which prints the words after it to the terminal.
After saving the above file, we need to give it execute permission to make it runnable. You can set the execute permission as follows
Execute script as anyone of the following commands
Sample Output
Now we are done with the very basic shell script that prints `Hello world` to the screen.
Before we go any deeper into few language constructs of shell scripting, you should have some basic knowledge of Linux commands. You can find several articles on the internet for that. Here is a sample article showing some of the commonly used ones.
Going Deep
Now that we have seen how to write a basic Hello World example, let’s look at some of the language constructs that you will find yourself using most of the time when writing shell scripts.
Variables
To process data, data must be kept in the computer’s memory. Memory is divided into small locations, and each location had a unique number called memory address, which is used to hold data.
Programmers can give a unique name to this memory address called variables. Variables are a named storage location that may take different values, but only one at a time.
In Linux Shell Scripting, there are two types of variable:
- System variables — Created and maintained by Linux itself. This type of variable defined in CAPITAL LETTERS.
- User-defined variables — Created and maintained by the user. This type of variable defined in lower letters.
System variables can be used in the script to show any information these variables are holding. Like few important System variables are:
- BASH —Holds our shell name
- BASH_VERSION — Holds our shell version name
- HOME — Holds home directory path
- OSTYPE — Holds OS type
- USERNAME – Holds username who is currently logged in to the machine
NOTE — Some of the above system variables may have a different value in a different environment.
User-defined variables are as simple as we have in any other programming language but variables can store any type of data, as in the following example:
To access user-defined variables use the following syntax:
Print to screen:
Use the above variable in a string:
Quotes
Following are the three types of quotes available in Shell scripting.
Double Quotes (“) : Anything inside double quotes will be string except \ and $. See example
Single quotes (‘) : Anything inside single quotes will be a string. See example:
Left Quotes (`): Anything enclosed in left quotes will be treated as an executable command. See examples
Conditions [if/else]
Shell scripts use fairly standard syntax for if statements. The conditional statement is executed using either the test command or the [ command.
In its most basic form an if statement is:
Have you noticed that fi is just if spelled backward? See below example that includes an else statement
Adding an else-if statement structure is used with the elif command.
There are many different ways in which conditional statements can be used in Shell scripting. Following tables elaborates on how to add some important comparison:
So this is the basic use of conditions in shell scripting is explained.
Looping
Almost all languages have the concept of loops, If we want to repeat a task ten times, we don’t want to have to type in the code ten times, with maybe a slight change each time.
As a result, we have for and while loops in the shell scripting. This is somewhat fewer features than other languages.
For Loop:
The above for loop first creates variable i and assign a number to it from the list of number from 1 to 5, The shell executes echo statement for each assignment of i and on every iteration, it will echo the statement as shown in the output. This process will continue until the last item.
While Loop
While loop will execute until the condition is true. See below example:
The above script first creates a variable i with the value 1. And then the loop will iterate until the value of i is less than equals to 5. The statement
i=`expr $i + 1` is responsible for the increment of value of i.
If this statement is removed the above said loop will be an infinite loop.
Functions
Function is a type of procedure or routine. Functions encapsulate a task (they combine many instructions into a single line of code). Most programming languages provide many built-in functions, that would otherwise require many steps to accomplish, for example calculating the square of a number.
In shell scripting, we can define functions in two manners.
- Creating a function inside the same script file to use.
- Create a separate file i.e. library.shwith all useful functions.
See below example to define and use a function in shell scripting:
Exit Status
The exit command terminates a script, just as in a C program. It can also return a value, which is available to the script’s parent process.
Every command returns an exit status (sometimes referred to as a return status or exit code). A successful command returns a 0, while an unsuccessful one returns a non-zero value that usually can be interpreted as an error code. Well-behaved UNIX commands, programs, and utilities return a 0 exit code upon successful completion, though there are some exceptions.
When a script ends with an exit that has no parameter, the exit status of the script is the exit status of the last command executed in the script (previous to the exit).
The equivalent of a exit is exit $? or even just omitting the exit.
$? is a special variable in shell that reads the exit status of the last command executed. After a function returns, $? gives the exit status of the last command executed in the function.
And with that, this article comes to an end. I hope you have got the basic idea by now. If you have any questions or feedback, leave them in the comments section below. For more information, check out Awesome Shell and GNU’s official bash reference.
Что такое bash в Linux? Гайд по созданию bash-скриптов
bash (сокр. от «Bourne-Again shell») — это командная оболочка (или «интерпретатор командной строки»), используемая по умолчанию в операционных системах на базе Unix и Linux, созданная в 1989 году Брайаном Фоксом с целью усовершенствования командной оболочки sh.
bash позволяет автоматизировать различные задачи, устанавливать программное обеспечение, настраивать конфигурации для своего рабочего окружения и многое другое. В этой статье мы рассмотрим использование нескольких основных команд в bash, а также рассмотрим гайд по созданию bash-скриптов.
Что такое терминал?
Терминал — это программа, которая используется для взаимодействия с шеллом. Это просто интерфейс к нему и другим программам командной строки, которые работают внутри нее. Вот как выглядит типичный терминал (Konsole) в Debian 11 (окружение рабочего стола — KDE Plasma):
Типичный терминал в Linux
Всякий раз, когда мы открываем окно терминала, мы видим приглашение шелла — имя_пользователя@имя_машины:
$ . Символ $ означает, что мы работаем под учетной записью обычного пользователя, а символ
(тильда) означает, что в данный момент мы находимся в домашнем каталоге /home/<имя_пользователя>.
Команды в bash
Команда в bash — это наименьшая единица кода, которую bash может выполнить. С помощью команд мы сообщаем шеллу, что нам нужно, чтобы он сделал. bash обычно принимает от пользователя одну команду и возвращается к нему после того, как команда будет выполнена. Чтобы немного освоиться в bash, давайте попробуем выполнить несколько простых команд.
Команда echo — возвращает всё, что вы вводите в командной строке:
Пример использования команды echo
Команда date — отображает текущее время и дату:
Пример использования команды date
Команда pwd (сокр. от «print working directory») — указывает на текущий рабочий каталог, в котором команды шелла будут искать файлы.
Файловая иерархия в Linux имеет древовидную структуру, поэтому, чтобы добраться до указанного каталога или файла, нам нужно пройти определенный путь, каждый узел которого отделен от других узлов символом / .
Пример использования команды pwd
Команда ls (сокр. от «list») — отображает содержимое каталога. Обычно, команда ls начинает с просмотра нашего домашнего каталога. Это означает, что если мы просто напечатаем ls , то данная команда выведет содержимое текущего каталога, которым в нашем примере является домашний каталог /home/diego:
Пример использования команды ls
Команда cd (сокр. от «change directory») — изменяет текущую директорию на заданную пользователем. Рассмотрим некоторые примеры использования данной команды:
cd <директория> — меняет текущую директорию на заданную. Давайте попробуем с помощью команды ls перейти к корневому каталогу / и ознакомимся с его содержимым. Обратите внимание, что мы также можем использовать точку с запятой ; для записи двух команд в одной строке.
Пример объединения двух команд в одной строке
cd .. — вернуться в родительский каталог.
cd — вернуться в домашний каталог.
Команда mkdir (сокр. от «make directory») — создает новый каталог.
Команда mv (сокр. от «move») — перемещает один или несколько файлов/каталогов из одного места в другое (заданное пользователем). Для этого нужно указать, что мы хотим переместить (т.е. источник), и куда мы хотим переместить (т.е. пункт назначения).
В качестве примера я создам новый каталог Ravesli в своей домашней директории и перемещу в него все .txt-файлы (ну как «все», у меня там только один файл — Адреса.txt) из /home/diego/Документы/ с помощью двух вышеприведенных команд:
Перемещение файлов с помощью команды mv
Команда touch — создает новые пустые файлы (а также изменяет временные метки в существующих файлах и каталогах). Вот как мы можем создать пустой файл под названием foo.txt в папке Ravesli из домашнего каталога:
Создание файла с помощью команды touch
Команда rm (сокр. от «remove») — удаляет файлы/каталоги. По умолчанию, команда rm НЕ удаляет каталоги, но если используется как rm -r * внутри заданного каталога, то каждый подкаталог и файл внутри заданного каталога — удаляются.
Давайте удалим ранее созданный файл foo.txt:
Удаление файла с помощью команды rm
Команда rmdir (сокр. от «remove directory») — удаляет каталоги.
Давайте удалим созданный ранее каталог /home/diego/Ravesli:
Удаление каталогов с помощью команды rmdir
Команда cat (сокр. от «concatenate») — считывает файл и выводит его содержимое. Она может работать с несколькими файлами, объединяя их вывод в единый поток (отсюда и происходит её название). У меня в домашнем каталоге есть папка untitled с файлами С++/Qt-проекта, и ниже я использую команду cat для просмотра содержимого файла main.cpp из untitled:
Пример использования команды cat
Чтобы просмотреть несколько файлов, укажите друг за другом (через пробел) имена требуемых файлов после команды cat , например:
Просмотр нескольких файлов с помощью команды cat
Команда man (сокр. от «manual») — отображает справочные страницы, которые являются руководством пользователя, встроенным по умолчанию во многие дистрибутивы Linux и большинство систем Unix. Например, команда man bash отобразит руководство пользователя, а команда man ls отобразит справку по команде ls .
Отображение справочной информации с помощью команды man
Редактор nano
nano — это маленький, простой, консольный текстовый редактор *nix-подобных операционных систем, впервые увидевший свет в далеком 1999 году. Для запуска редактора достаточно ввести в терминале всего одну команду — nano . Если же нужно отредактировать какой-то конкретный файл, то применяется команда nanо /<путь_к_файлу/<имя_файла> . Отличительной чертой данного редактора является то, что он управляется сочетаниями клавиш. Например, для сохранения текущего документа применяется сочетание Ctrl+O, для вызова меню поиска — Ctrl+W, для выхода из редактора — Ctrl+X, а для получения всего списка доступных сочетаний клавиш — Ctrl+G.
Гайд по созданию bash-скриптов
Наш шелл, это не только промежуточное звено между пользователем и системой, но еще и мощный язык программирования. Программы, написанные на языке шелла, называются shell-скриптами (или shell-сценариями) и имеют соответствующее расширение файлов — .sh. Сам язык содержит полный набор утилит и команд, доступных в *nix-системах, а также циклы, условные операторы, объявление переменных и пр. Такие скрипты будут очень полезными там, где не требуется использование полноценных языков программирования, например, в задачах администрирования операционной системы.
Создание bash-скрипта
Чтобы создать новый файл bash-скрипта, откройте в любом редакторе текстовый файл и сохраните его с расширением .sh. Все дальнейшие эксперименты я будут проводить в Debian Linux, с применением текстового редактора nano.
Давайте создадим новый файл ravesli.sh:
$ touch ravesli.sh
diego@debian:
$ ls -l
-rw-r—r— 1 diego diego 0 мар 9 14:59 ravesli.sh
diego@debian:
Чтобы выполнить файл bash-скрипта, нужно изменить права доступа к файлу и сделать его исполняемым. Разрешение, как вы наверняка помните из предыдущих уроков, изменяется командой chmod +x <имя_файла> :
$ chmod +x ravesli.sh
diego@debian:
$ ls -l
итого 40
drwxr-xr-x 2 diego diego 4096 фев 27 00:23 build-untitled-Desktop-Debug
-rw x r- x r- x 1 diego diego 0 мар 9 14:59 ravesli.sh
Выполнение bash-скрипта
Файл bash-скрипта может быть запущен двумя способами:
Способ №1: bash <имя_файла> . Чтобы выполнить скрипт, просто напишите в терминале команду bash , а затем (через пробел) имя файла и нажмите Enter.
Способ №2: ./<имя_файла> . Чтобы выполнить скрипт введите команду ./<имя_файла> и нажмите Enter.