117 lines
1.5 KiB
Org Mode
117 lines
1.5 KiB
Org Mode
#+options: toc:nil num:nil author:nil
|
|
|
|
* Files and directories
|
|
|
|
** Create empty file
|
|
|
|
Create "file.txt" with command ~touch~
|
|
|
|
#+begin_src sh
|
|
touch file.txt
|
|
#+end_src
|
|
|
|
Create a file redirecting the shell output using "~>~" operator
|
|
|
|
#+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
|
|
|
|
#+begin_src sh
|
|
ls
|
|
#+end_src
|
|
|
|
List with properties using options ~-l~ and ~-la~
|
|
|
|
#+begin_src sh
|
|
ls -l
|
|
ls -la
|
|
#+end_src
|
|
|
|
List using wildcards
|
|
|
|
List all files ending in ".csv"
|
|
|
|
#+begin_src sh
|
|
ls *.csv
|
|
#+end_src
|
|
|
|
List all files containing the characters "moda" within name, e.g.,
|
|
"acomoda", "comoda.txt"...
|
|
|
|
#+begin_src sh
|
|
ls *moda*
|
|
#+end_src
|
|
|
|
Remove "x"
|
|
|
|
#+begin_src sh
|
|
rm x
|
|
#+end_src
|
|
|
|
Copy a file using "~cp~ source destination"
|
|
|
|
#+begin_src sh
|
|
cp /home/text.csv /home/myuser/text.csv
|
|
#+end_src
|
|
|
|
Create directory
|
|
|
|
#+begin_src sh
|
|
mkdir new_dir
|
|
#+end_src
|
|
|
|
Remove (unlink) a directory
|
|
|
|
Some arguments:
|
|
|
|
* -r: recursively unlink
|
|
* -v: verbose
|
|
* -f: force
|
|
|
|
#+begin_src sh
|
|
rm -r new_dir
|
|
#+end_src
|
|
|
|
Remove a file
|
|
|
|
#+begin_src sh
|
|
rm file.txt
|
|
#+end_src
|
|
|
|
Space used by a directory
|
|
|
|
#+begin_src sh
|
|
du -hs /usr
|
|
#+end_src
|
|
|
|
Display directory
|
|
|
|
#+begin_src sh
|
|
pwd
|
|
#+end_src
|
|
|
|
Change directory you are working from terminal.
|
|
|
|
Go to the home of the user
|
|
|
|
#+begin_src sh
|
|
cd
|
|
#+end_src
|
|
|
|
Go one level up in the directory tree
|
|
|
|
#+begin_src sh
|
|
cd ..
|
|
#+end_src
|
|
|
|
Go to "Documents" directory
|
|
|
|
#+begin_src sh
|
|
cd /home/myuser/Documents
|
|
#+end_src
|