aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYaroslav de la Peña Smirnov <yps@yaroslavps.com>2021-10-31 21:28:05 +0300
committerYaroslav de la Peña Smirnov <yps@yaroslavps.com>2021-10-31 21:28:05 +0300
commit3b57624e71e62beed33a5ce0cf69be05108c4482 (patch)
tree24052c568de66aa27421eb5620a057c8d67145a7
parent8d9c2b79a46da097a189134b5f8314cd7e306494 (diff)
downloadyaroslavps.com-3b57624e71e62beed33a5ce0cf69be05108c4482.tar.gz
yaroslavps.com-3b57624e71e62beed33a5ce0cf69be05108c4482.zip
Some more corrections
-rw-r--r--content/weblog/2018-12-31_intro-to-linux-and-bash-pt2/index.md36
-rw-r--r--content/weblog/2018-12-31_intro-to-linux-and-bash-pt2/index.ru.md36
2 files changed, 36 insertions, 36 deletions
diff --git a/content/weblog/2018-12-31_intro-to-linux-and-bash-pt2/index.md b/content/weblog/2018-12-31_intro-to-linux-and-bash-pt2/index.md
index 5739e06..741bd67 100644
--- a/content/weblog/2018-12-31_intro-to-linux-and-bash-pt2/index.md
+++ b/content/weblog/2018-12-31_intro-to-linux-and-bash-pt2/index.md
@@ -29,7 +29,7 @@ However, there's also a utility to create blank files called touch.
You can make a blank file by writing touch followed by the path of the file you
wish to create, like this
-```sh
+```
user@host:~$ touch example.txt
```
@@ -46,7 +46,7 @@ sometimes.
Now on to something more interesting, making directories. This one is quite
simple, and the command for that is mkdir. For example
-```sh
+```
user@host:~$ mkdir foo
```
@@ -60,7 +60,7 @@ If we were to indicate an absolute path like "/home/user/foo" we would need to
make sure that directories "home" and "user" already exist. However, there's a
useful argument we can pass to mkdir to make parent directories if needed, -p
-```sh
+```
user@host:~$ mkdir -p /tmp/foo/bar
```
@@ -75,7 +75,7 @@ which is short for move.
If you want to rename a file or directory, simply "move" it to the same
destination directory with a new/different name, for example
-```sh
+```
user@host:~$ mv untitled titled
```
@@ -83,7 +83,7 @@ If you want to move it to a different location, just indicate that path as the
second argument. Remember that we are using paths here, and we use either
absolute or relative paths
-```sh
+```
user@host:~$ mv titled Documents/titled
```
@@ -92,7 +92,7 @@ user@host:~$ mv titled Documents/titled
Copying files is similar to moving them, except that the command is different,
cp
-```sh
+```
user@host:~$ cp titled Documents/titled2
```
@@ -103,7 +103,7 @@ with the directory (and files in those subdirectories and files the
subdirectories of the subdirectories and... yeah recursion, you get it) to the
destination path. So we would do something like this
-```sh
+```
user@host:~$ cp -r dir dir-copy
```
@@ -112,7 +112,7 @@ user@host:~$ cp -r dir dir-copy
Removing files is pretty simple, just use rm followed by the path of the file,
for example
-```sh
+```
user@host:~$ rm title
```
@@ -127,7 +127,7 @@ everything that is in it.
So to remove a directory and everything in it, we input something like this
-```sh
+```
user@host:~$ rm -r dir
```
@@ -146,7 +146,7 @@ repository from your computer, since it contains a lot of special hidden files
which git uses to keep track of your commits and other stuff. So to remove it,
we do
-```sh
+```
user@host:~$ rm -rf somerepo
```
@@ -179,7 +179,7 @@ If you read the first part of this guide you might remember that I mentioned
using the command "ls -l" to list the contents of the directory with details
about the files, including permissions
-```sh
+```
user@host:~/Documents$ ls -l
drwxr-xr-x 2 user user 4.0K Jul 18 04:20 Books
-rwxr-xr-- 1 user group 350 Jul 18 04:20 run.py
@@ -235,7 +235,7 @@ The easier way is made up of three parts
So let's suppose we have a script we want to set the execute permission for so
that any user in the computer can execute it.
-```shh
+```
user@host:~/Documents/stuff$ ls -l
-rw-r--r-- 1 user group 420 April 20 6:59 script.sh
user@host:~/Documents/stuff$ chmod a+x script.sh
@@ -247,7 +247,7 @@ execute permission on the script. Now let's say that we want to revoke read
permissions for everybody except for the owner (user), we could execute o-r and
then g-r, but we can also combine them, like so
-```sh
+```
user@host:~/Documents/stuff$ chmod go-r script.sh
-rwx--x--x 1 user group 420 April 20 6:59 script.sh
```
@@ -311,7 +311,7 @@ So let's say for example that we want to set the permissions of file so that the
owner can read, write, and execute, the group can read and execute, and others
can only execute. It would look something like this
-```sh
+```
user@host:~/Documents/stuff$ chmod 751 script.sh
user@host:~/Documents/stuff$ ls -l
-rwxr-x--x 1 user group 420 April 20 6:59 script.sh
@@ -328,7 +328,7 @@ Changing the owner of a file is easier than changing permissions, since less
variables are involved. To change owner we use the chown command, for example,
change the user that owns a file
-```sh
+```
user@host:~/.logs$ ls -l
-rw-r--r-- 1 root root 69 April 20 6:59 some.log
user@host:~/.logs$ sudo chown user some.log
@@ -346,7 +346,7 @@ and a quick search on the internet will give you the information needed.
Now let's say that you wanted to change both the user and group that file
belongs to, we would do like this
-```sh
+```
user@host:~/.logs$ ls -l
-rw-r--r-- 1 root root 69 April 20 6:59 some.log
user@host:~/.logs$ sudo chown user:group some.log
@@ -366,14 +366,14 @@ separator between arguments.
There are two ways of writings paths and filenames (and other arguments) with
spaces. One is to put the argument between quotation marks, like for example
-```sh
+```
user@host:~/Documents$ rm "Shopping List.txt"
```
Another is to use an escape character, i.e. just put a backslash (\) before the
space, like this
-```sh
+```
user@host:~/Documents$ rm Shopping\ List.txt
```
diff --git a/content/weblog/2018-12-31_intro-to-linux-and-bash-pt2/index.ru.md b/content/weblog/2018-12-31_intro-to-linux-and-bash-pt2/index.ru.md
index de4db1d..10d24b1 100644
--- a/content/weblog/2018-12-31_intro-to-linux-and-bash-pt2/index.ru.md
+++ b/content/weblog/2018-12-31_intro-to-linux-and-bash-pt2/index.ru.md
@@ -29,7 +29,7 @@ vim для редактирования и записи текстовых фа
Вы можете создать пустой файл введя touch и последовательно название или путь
файла который вы хотите создать, например
-```sh
+```
user@host:~$ touch example.txt
```
@@ -47,7 +47,7 @@ user@host:~$ touch example.txt
Сейчас у нас будет что-то поинтереснее, как создать директорий. Создавать
директории довольно просто, команда - mkdir. Например
-```sh
+```
user@host:~$ mkdir foo
```
@@ -61,7 +61,7 @@ user@host:~$ mkdir foo
существуют. Однако, существует очень подезный флажок, которые мы можем передать
команде, чтобы она создавала родительские директории при необходимости - -p
-```sh
+```
user@host:~$ mkdir -p /tmp/foo/bar
```
@@ -76,7 +76,7 @@ user@host:~$ mkdir -p /tmp/foo/bar
Если вам необходимо переименовать файл или директорий, переместите его в тот же
самый директорий, с новым/другим названием, например
-```sh
+```
user@host:~$ mv untitled titled
```
@@ -84,7 +84,7 @@ user@host:~$ mv untitled titled
локации в качестве второго аргумента. Не забудьте что оба аргумента являются
путями, либо относительными либо абсолютными
-```sh
+```
user@host:~$ mv titled Documents/titled
```
@@ -92,7 +92,7 @@ user@host:~$ mv titled Documents/titled
Копирование похоже на перемещения, отличие просто в названии команды - cp.
-```sh
+```
user@host:~$ cp titled Documents/titled2
```
@@ -103,7 +103,7 @@ user@host:~$ cp titled Documents/titled2
поддиректории и... ну то есть, рекурсия) в указанный путь. То есть что-то похоже
на это
-```sh
+```
user@host:~$ cp -r dir dir-copy
```
@@ -111,7 +111,7 @@ user@host:~$ cp -r dir dir-copy
Удалять файлы довольно просто, достаточно ввести rm а затем путь файла
-```sh
+```
user@host:~$ rm title
```
@@ -126,7 +126,7 @@ user@host:~$ rm title
Итак, чтобы удалить директорию и все содержимое, нам понадобиться ввести
следующую команду
-```sh
+```
user@host:~$ rm -r dir
```
@@ -146,7 +146,7 @@ user@host:~$ rm -r dir
множество специальных скрытых файлов, которые git использует затем чтобы следить
за коммитами и прочее. Пример использования команды
-```sh
+```
user@host:~$ rm -rf somerepo
```
@@ -180,7 +180,7 @@ user@host:~$ rm -rf somerepo
команду "ls -l" чтобы посмотреть дополнительную информацию о файлах, включая
права доступа
-```sh
+```
user@host:~/Documents$ ls -l
drwxr-xr-x 2 user user 4.0K Jul 18 04:20 Books
-rwxr-xr-- 1 user group 350 Jul 18 04:20 run.py
@@ -236,7 +236,7 @@ drwxr-xr-x 2 user user 4.0K Jul 18 04:20 Books
Допустим у нас есть скрипт для которого мы хотим дать право на запуск для всех
пользователей.
-```sh
+```
user@host:~/Documents/stuff$ ls -l
-rw-r--r-- 1 user group 420 April 20 6:59 script.sh
user@host:~/Documents/stuff$ chmod a+x script.sh
@@ -248,7 +248,7 @@ user@host:~/Documents/stuff$ chmod a+x script.sh
отменить право выполнения для всех пользователей кроме владелца, мы могли бы
ввести o-r и затем g-r, но мы можем также совмещать следующим образом
-```sh
+```
user@host:~/Documents/stuff$ chmod go-r script.sh
-rwx--x--x 1 user group 420 April 20 6:59 script.sh
```
@@ -317,7 +317,7 @@ user@host:~/Documents/stuff$ chmod go-r script.sh
выполнения; и остальные могли только выполнять. Для этого мы ввели что-то
подобное
-```sh
+```
user@host:~/Documents/stuff$ chmod 751 script.sh
user@host:~/Documents/stuff$ ls -l
-rwxr-x--x 1 user group 420 April 20 6:59 script.sh
@@ -335,7 +335,7 @@ user@host:~/Documents/stuff$ ls -l
использовать команду chown. Например, допустим мы хотим поменять пользователя,
которого владеет файлом
-```sh
+```
user@host:~/.logs$ ls -l
-rw-r--r-- 1 root root 69 April 20 6:59 some.log
user@host:~/.logs$ sudo chown user some.log
@@ -355,7 +355,7 @@ user@host:~/.logs$ ls -l
А теперь допустим что вы хотели поменять и пользователя и группу которому
принадлежит файл, в таком случае мы бы ввели следующее
-```sh
+```
user@host:~/.logs$ ls -l
-rw-r--r-- 1 root root 69 April 20 6:59 some.log
user@host:~/.logs$ sudo chown user:group some.log
@@ -375,13 +375,13 @@ user@host:~/.logs$ ls -l
Есть два способа печатать пути, названия файлов и другие аргументы с пробелами.
Первый способ - кавычки. Например
-```sh
+```
user@host:~/Documents$ rm "Shopping List.txt"
```
Второй - экранирования символа с помощью символа "\" перед пробелом. Например
-```sh
+```
user@host:~/Documents$ rm Shopping\ List.txt
```