This repository presents a guidance and examples of the basics of Linux operative system.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
7.9 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. # Basics of GNU/Linux
  2. First we will introduce some of the most used Bash commands. By using this command we will learn how to manage files, directories, and modify the contents of files. Later, the terminal is introduced. The terminal will be our most used front-end frame to work in mobile devices or servers. Thus, few improvements are going to be make, to support our daily task in the Bash terminal. Finally, we will work with the package manger tool. We are going to install some useful packages that will be used later, and we will make some data science in terminal by creating our first on-liner task.
  3. ## Basic File System Commands
  4. The most used commands at the terminal are listed below. These are know as File System Commands, because they mainly handle file in our system
  5. | Name | Command | options | example |
  6. |-------------------|---------|---------------------------------------|----------------------------------|
  7. | List files | ls | -a shows all | ls -la |
  8. | | | -l long format | |
  9. | | | -R recursive | |
  10. |-------------------|---------|---------------------------------------|----------------------------------|
  11. | Current directory | pwd | -P prints the physical location | pwd |
  12. |-------------------|---------|---------------------------------------|----------------------------------|
  13. | Change | cd | .. takes you up a level | cd /home/gmarx |
  14. | directory | | ~ takes you to home directory | cd ~ |
  15. |-------------------|---------|---------------------------------------|----------------------------------|
  16. | Make | mkdir | -p make parent directories as needed | mkdir -p test/example |
  17. | directory | | -v print a message for each directory | mkdir -p /test/example |
  18. | | | | *first example creates |
  19. | | | | folders inside the |
  20. | | | | current folder, other one |
  21. | | | | creates folder in root directory |
  22. |-------------------|---------|---------------------------------------|----------------------------------|
  23. | Delete a | rm | -r recursive (use for directories) | rm sample.txt |
  24. | file or directory | | -d remove empty directory | rm -r test |
  25. |-------------------|---------|---------------------------------------|----------------------------------|
  26. | Copy a file | cp | -r recursivec copy | cp a.txt b.txt |
  27. | or directory | | -u copy only if the source is newer | cp test-a test-b |
  28. | | | -v verbose (show output) | |
  29. |-------------------|---------|---------------------------------------|----------------------------------|
  30. | Move a file or | mv | -i prompts before overwrite | mv a.txt c.txt |
  31. | directory | | No -r; Moving into the same directory | mv test example |
  32. | | | performs a renaming | |
  33. |-------------------|---------|---------------------------------------|----------------------------------|
  34. | | touch | | |
  35. |-------------------|---------|---------------------------------------|----------------------------------|
  36. | | more | | |
  37. |-------------------|---------|---------------------------------------|----------------------------------|
  38. | | cal | | |
  39. |-------------------|---------|---------------------------------------|----------------------------------|
  40. | | | | |
  41. ## Terminal
  42. There are several Terminal emulators that will help to visualize and work better during a connection to our local or remote system.
  43. I have tested some of them and I can recommend some of they:
  44. * [ConEmu](https://conemu.github.io). ConEmu is a powerful and fast window based terminal manager that can handle all the shell in your Windows system (cmd, PowerShell, Git Bash, Python). *However the colors and text make an ugly tool to work with for several hours*.
  45. * [Hyper](https://hyper.is). Hyper is a terminal built on web technologies, based on JavaScript, HTML, and CSS providing a beautiful and extensible experience for command-line interface users. The application has a lot of APIs and extension and is highly configurable for several tasks. *However, the emulator requieres a complex configuration file and the speed of the emulator is not good enough compared with other projects*.
  46. * [Alacritty](https://github.com/alacritty/alacritty). Alacritty is a modern terminal emulator that comes with sensible defaults, but allows for extensive configuration. By integrating with other applications, rather than reimplementing their functionality, it manages to provide a flexible set of features with high performance. The supported platforms currently consist of BSD, Linux, macOS and Windows. The project is in Beta version but actually used by several users daily. *However, the first approach for new user and lack of information make roughly first contact*.
  47. Once you have decided and installed a terminal emulator, we can start typing commands and improving the Bash. Below, there are some terminal commands to move around in the daily typing task.
  48. | Command | Description |
  49. |---------|------------------------|
  50. | CTRL-c | Stop current command |
  51. | CTRL-z | Sleep program |
  52. | CTRL-a | Go to start of line |
  53. | CTRL-e | Go to end of line |
  54. | CTRL-u | Cut from start of line |
  55. | CTRL-k | Cut to end of line |
  56. | CTRL-r | Search history |
  57. | !! | Repeat last command |
  58. | Tab key | Autocompletes |
  59. |---------|------------------------|
  60. | | |
  61. Remember that the terminal is the front-end window of the back-end shell system. The system can be Shell, Bash, Fish, Z-Shell, or any other. The most standard used or pre-installed one is the Bash (Bourne-again Shell), Bash is a command processor that typically runs in a text window where the user types commands that cause actions. Bash can also read and execute commands from a file, called a shell script. Like most Unix shells, it supports filename globbing (wildcard matching), piping, here documents, command substitution, variables, and control structures for condition-testing and iteration. The keywords, syntax, dynamically scoped variables and other basic features of the language are all copied from sh. Other features, e.g., history, are copied from csh and ksh. Bash is a POSIX-compliant shell, but with a number of extensions.
  62. *** Package management
  63. | Command | Debian |
  64. |------------------------------------|----------------------|
  65. | Install a package | sudo apt install vim |
  66. | Upgrade the package in your system | sudo apt upgrade |
  67. |------------------------------------|----------------------|
  68. | | |
  69. *** Basic file editing with VIM
  70. *** Expanding the file system