Terminal commands
Some of the useful terminal commands in DecriptOS
Terminal Commands for Decripto OS
The terminal is a text-based interface through which you can interact with the Linux operating system. The following commands are fundamental for getting started with the terminal.
General Commands
1. ls - List files and folders
This command lists the files and folders in the current directory.
Example:
lsYou can also use it to preview specific folders or files starting from the full or partial name:
ls folder_namels name*ls *folderls *name*2. cd - Change directory
This command allows you to navigate between folders. You can specify an absolute or relative path.
Examples:
cd /absolute/pathcd destination_folderto return to the parent folder
cd ..to return to your home directory
cd ~cd3. mkdir - Create a new folder
This command creates a new folder in the current directory or a specific location.
Examples:
mkdir new_foldermkdir /existing/path/new_folder4. touch - Create a new file
This command creates a new empty file in the current directory or a specific location.
Examples:
touch new_file.txttouch /existing/path/new_file.txt5. rm - Remove files and folders
This command removes files and folders. Use with caution as deleted files are permanently removed and not moved to the trash.
Examples:
rm file_to_remove.txtrm -r folder_to_removerm -d empty_folder_to_remove6. cp - Copy files and folders
This command copies files and folders from one location to another.
Examples:
cp file_to_copy.txt /path/destinationcp -r folder_to_copy /path/destination7. mv - Move or rename files and folders
This command moves or renames files and folders.
Examples:
mv file_to_move.txt /path/destinationmv old_name.txt new_name.txt8. cat - Display the content of a file
This command displays the content of a file on the terminal.
Example:
cat file_to_view.txt9. grep - Search inside files
This command searches for a specific string within one or more files.
Example:
grep "word_to_search" reference_file.txt10. sudo - Execute commands as administrator
This command executes the following command with administrator privileges (sudo = super user do).
Example:
sudo apt updatesudo apt upgrade11. open - Opens a file or folder
This command opens a file with the default program or a folder.
Example:
open folder open the folder where you are currently
open .open file.txt12. ip addr - Shows IP address specifications
Example:
ip addr13. passwd - Set the system password
Example:
sudo passwd13. ip addr - Shows IP address specifications
Example:
ip addr14. ssh-keygen - Generating an SSH key
Example:
ssh-keygen -t ed25519 -C [your@email.com]To link GitHub via SSH:
Create the SSH key
ssh-keygen -t ed25519 -C [your@email.com]
enter the file in which to save the key or skip to keep /home/decripto/.ssh/id_ed25519
[enter password or skip]
Copy the SSH key from the .pub file in the
/home/decripto/.ssh/folder (something like:ssh-ed25519 AAAAC3NzaCC1.....7kX0J)
you can enter this command to show your public key:
cat .ssh/id_ed25519.pubOpen GitHub and go to settings, SSH, new, paste, and give it a name
15. man - Opens the manual for a command
Example:
man ls (shows the manual for the 'ls' command)man mkdir (shows the manual for the 'mkdir' command)Git Commands to Sync Folders with GitHub
Git is a widely used distributed version control system. Below are some main commands to sync folders with GitHub using Git.
1. git init - Initialize a local Git repository
This command initializes a new local Git repository in the current directory.
Example:
git initThen configure Git with the main branch:
git config --global init.default branch mainTo create or rename the main branch to "main":
git branch -M mainAnd configure your credentials for commits:
git config --global user.name "your name"git config --global user.email [your@email.com]2. git clone - Clone an existing repository
This command clones an existing Git repository from GitHub into the current directory.
Example:
git clone https://github.com/user/repository.git3. git status - Check the folder and file status
Example:
git status4. git diff - Show differences between the last commit and the current file
It can also be used to show differences between 2 branches with ..
Example:
git diffgit diff main..other-branch5. git add - Adds files to the repository
This command adds one or more files to the Git repository.
Example:
git add file_to_add.txtOr to add all of them use add .
Example:
git add .6. git commit - Commit the changes
This command creates a new commit with the changes made. The -m parameter allows you to enter the comment afterward.
Example:
git commit -m "Description of changes"Note: if a description for the commit is not added, vim will be opened from the terminal to insert it. Vim is cumbersome, so always insert the message immediately.
To insert the description with vim:
Press the 'i' key to enter text
Write the description
Press Esc to exit insert mode
Type
:wqto write and exit
7. git push - Synchronize remote changes
This command sends local commits to the remote repository on GitHub.
Example:
git push origin branch_name8. git pull - Update the local repository
This command updates the local repository with changes from the remote repository on GitHub.
Example:
git pull origin branch_nameThese are just a few of the most common commands used in the terminal to work with Git. There are many other commands and options that you can further explore here.
Last updated
Was this helpful?