Updating tutorial

This commit is contained in:
Jose 2023-02-05 19:21:52 -03:00
parent fbea7d3de4
commit 99491079ac
1 changed files with 49 additions and 30 deletions

View File

@ -6,59 +6,64 @@
Create "file.txt" with command ~touch~
: touch file.txt
#+begin_src sh
touch file.txt
#+end_src
Create a file redirecting the shell output using "~>~" operator
: echo I will put this text wthin a file > file2.txt
#+begin_src sh
echo "I will put this text wthin a file" > file2.txt
#+end_src
** List files
Use ~ls~ in the directory you want to explore
: ls
#+begin_src sh
ls
#+end_src
List with properties using options ~-l~ and ~-la~
: ls -l
: ls -la
#+begin_src sh
ls -l
ls -la
#+end_src
List using wildcards
List all files ending in ".csv"
: ls *.csv
#+begin_src sh
ls *.csv
#+end_src
List all files containing the characters "moda" within name, e.g.,
"acomoda", "comoda.txt"...
: ls *moda*
#+begin_src sh
ls *moda*
#+end_src
Remove "x"
: rm x
#+begin_src sh
rm x
#+end_src
Copy a file using "~cp~ source destination"
: cp /home/text.csv /home/myuser/text.csv
Copy multiple files, directories or disk using "rsync" (source, destination).
The command accepts arguments:
- "-r" recursive
- "-v" verbose
- "-a" archive (keeps info about files)
: rsync -rav /home/user/Documents /run/media/user/disk/backup/
~rsync~ can be also used with selective copyng based on file type
: rsync /home/user/Desktop/*.jpg /home/user/Desktop/backupdata/
#+begin_src sh
cp /home/text.csv /home/myuser/text.csv
#+end_src
Create directory
: mkdir new_dir
#+begin_src sh
mkdir new_dir
#+end_src
Remove (unlink) a directory
@ -68,30 +73,44 @@ Some arguments:
* -v: verbose
* -f: force
: rm -r new_dir
#+begin_src sh
rm -r new_dir
#+end_src
Remove a file
: rm file.txt
#+begin_src sh
rm file.txt
#+end_src
Space used by a directory
: du -hs /usr
#+begin_src sh
du -hs /usr
#+end_src
Display directory
: pwd
#+begin_src sh
pwd
#+end_src
Change directory you are working from terminal.
Go to the home of the user
: cd
#+begin_src sh
cd
#+end_src
Go one level up in the directory tree
: cd ..
#+begin_src sh
cd ..
#+end_src
Go to "Documents" directory
: cd /home/myuser/Documents
#+begin_src sh
cd /home/myuser/Documents
#+end_src