8 life-saving terminal commands every user should know

0
8 life-saving terminal commands every user should know

When it comes to working with your computer, knowing terminal commands can be essential for increasing your productivity, speeding up work processes, and fixing complicated bugs in the event that you run into an issue with your machine’s software. However, there are hundreds of these commands, and it can take months to learn them all. That’s why we’ve narrowed down the list to the top 8 terminal commands every user should know – if you memorize these and keep them at hand, you’ll always be prepared to make the most of your time at the terminal!

Navigate faster with a cd

If you’re constantly typing out long file paths, you’re wasting valuable time. The cd command lets you navigate to any directory on your computer quickly and easily. Just type cd followed by the path of the directory you want to go to. For example, if you want to go to your home directory, you would type cd ~. You can also use the .. notation to move up one directory level. So, if you’re in your home directory and want to go to the Desktop directory, you would type cd Desktop.

 

Copy files with cp

The cp command is used to copy files and directories. It can be used to copy a file from one directory to another or to copy multiple files into a single directory. To copy a file, you need to specify the source file and the destination. The format for the cp command is cp  SOURCE DEST. Options are as follows: -i (interactive) prompts before overwriting an existing destination file; -v (verbose) prints a list of what’s being copied; -u (update) copies only when the SOURCE file is newer than the destination; -r (recursive) copies files/directories recursively the techno tricks;

 

Copy multiple files with Rsync

You can use the sync command to copy multiple files at once. This is especially useful when you’re working with a lot of data. The syntax for this command is: Rsync -av source destination. The -a flag stands for archive mode, which preserves file permissions and ownership. The -v flag enables verbose mode, so you can see what’s happening as the files are being copied.

Get a list of files with ls

The ls command is probably the most basic and important command there is. It lists the files and folders in your current directory. By default, it displays them in alphabetical order. But you can also sort them by date, size, or extension with the -ltr arguments.

You can also use ls to show hidden files with the -a flag. This is helpful if you’re trying to find a file that you know is there but you can’t see it. Just type ls -a and all of the hidden files will be revealed.

If you want to see more information about each file, such as when it was last modified or how big it is, you can use the -l flag.

Delete files with rm

If you want to delete a file, you can use the rm command. This will remove the file from your system permanently. Be careful with this command, as you cannot undelete files once they are removed. To delete a file, type rm followed by the name of the file you want to delete. For example, to delete a file named file1, you would type rm file1. You can also delete multiple files at once by typing rm followed by the names of the files you want to delete, separated by spaces. For example, to delete both file1 and file2, you would type rm file1 file2.

List directories with ls

The ls command is one of the most basic and essential commands in the terminal. It’s used to list the contents of a directory, and it has a lot of options and features that can make it more powerful. Here are seven things you can do with the ls command.

  1. List all files, including hidden ones, in a directory: ls -a

Refresh your memory using man

The man command is used to format and display the manual pages of a command. These manual pages provide detailed information about a command, its usage, options, and examples. To use the man command, simply type man followed by the name of the command you want to learn more about. For example, to learn more about the ls command, you would type: man ls thetechnotricks.

 

  • Manage file permissions with chmod, chown, and chgrp
  • The chmod command is used to change the permissions of a file.
  • To use chmod, you specify the desired permission settings and the file or files that you wish to modify.
  • For example, the following command would give all users read and write permissions to a file named foo.txt:
  • chmod o+rw foo.txt

Leave a Reply

Your email address will not be published. Required fields are marked *