Basic Commands in Linux
1. PWD
The PWD command will show the currant working directory (also known as folder) .
2. Ls command
- The Ls command is used to show all the content inside a directory. The default setting will show the contents of the current directory.
- If you want to see the content in the other folders, you should type the folder path after the Ls command
Ls-R List all files in subdirectories
Ls-a List of hidden filles
Ls-al List detailed information of files and directories.
3. CD command
- The cd command is used to navigate between files and folders. you need to type the full path or the directory's name (depending on your current directory)
cd- go straight tot he home folder
cd-(with a hyphen) move to your previous directory
4. MKDIR command
- mkdir command create new directories.
- For example: to make a directory called pictures, you can type mkdir pictures.
- To generate a new directory inside another directory - use format (mkdir picture/europe)
5. RMDIR command
- To delete a directory, uses the rmdir command. However, rmdir only allows to delete empty directories.
6.RM command
- RM command is used to delete files.
- If you want to delete all the files in a directory, use rm -r command.
7. TOUCH command
- It is used to create empty files directly from the command line.
8. FIND command in Linux
- The find command is used to search for files and directories. It is used to find files within a given directory.
9. SUDO command
- The sudo command will let you perform tasks that require root privileges.
10.CAT command
- CAT (short for concatenate) is one of Linux's most frequently used commands. This is used to list the contents of a file on the standard output.
some other ways to use the cat command are:
- To create new file
cat > filename
- To join two files(1 and 2) and store the output of them in a new file(f3)
cat filename1 filename2>filename3
- To convert a file to upper or lower case
cat filename | tr a-z A-Z >output.txt
11. CP command
- cp command is to copy files or directories, including their content, from your current location to another.
12. MV command
The mv command has two function
To move files
To rename files
- To move a file, type a command as
mv test.txt /home/1gbits/document
- To rename files, use command as
(mv file1.txt file5.txt ) and file will change to file5.txt.
Comments
Post a Comment