LINUX COMMANDS

 

LINUX COMMANDS

Linux Commands

Functions

1. Is command in Linux

Displays information about files in the current directory.

2. pwd command in Linux

Displays the current working directory.

3. mkdir command in Linux

Creates a directory.

4. cd command in Linux

To navigate between different folders.

5. rmdir command in Linux

Removes empty directories from the directory lists.

6. cp command in Linux

Copy files from one directory to another.

7. mv command in Linux

Rename and Replace the files

8. rm command in Linux

Delete files

9. uname command in Linux

Command to get basic information about the OS

10. locate command in Linux

Find a file in the database.

11. touch command in Linux

Create empty files

12. ln command in Linux

Create shortcuts to other files

13. cat command in Linux

Display file contents on terminal

14. clear command in Linux

Clear terminal 

15. ps command in Linux

Display the processes in terminal

16. man command in Linux

Access manual for all Linux commands

17. grep command in Linux

Search for a specific string in an output

18. echo command in Linux

Print string or text to the terminal

19. wget command in Linux

download files from the internet.

20. whoami command in Linux

Displays the current users name

21. sort command in Linux

sort the file content

22. cal command in Linux

View Calendar in terminal

23. whereis command in Linux

View the exact location of any command typed after this command

24. df command in Linux

Check the details of the file system

25. wc command in Linux

Check the lines, word count, and characters in a file using different options

 













































Linux commands syntax with examples

 

๐Ÿ“ 1. ls – List directory contents

  • Syntax: ls [options] [directory]
  • Example:

ls              # Lists files in the current directory

ls -l           # Long listing format

ls -a           # Includes hidden files

ls /home/user   # Lists contents of a specific directory

 

๐Ÿ“‚ 2. cd – Change directory

  • Syntax: cd [directory]
  • Example:

cd /home/user/Documents   # Go to Documents

cd ..                     # Move up one directory

cd ~                      # Go to home directory

 

๐Ÿ“„ 3. touch – Create empty file

  • Syntax: touch [filename]
  • Example:

touch file1.txt            # Create an empty file

 

๐Ÿ“ 4. cat – View or create files

  • Syntax: cat [options] [file(s)]
  • Example:

cat file.txt               # Display content

cat > newfile.txt          # Create a file, input ends with CTRL+D

cat file1.txt file2.txt    # Concatenate files

 

๐Ÿ—ƒ 5. cp – Copy files or directories

  • Syntax: cp [options] source destination
  • Example:

bash

CopyEdit

cp file1.txt file2.txt     # Copy file

cp -r dir1/ dir2/          # Copy directory recursively

 

๐Ÿ”„ 6. mv – Move or rename files

  • Syntax: mv source destination
  • Example:

mv oldname.txt newname.txt   # Rename file

mv file.txt /home/user/      # Move file

 

๐Ÿ—‘ 7. rm – Remove files or directories

  • Syntax: rm [options] file
  • Example:

rm file.txt              # Delete file

rm -r directory/         # Delete directory and contents

 

๐Ÿ›  8. mkdir – Create directory

  • Syntax: mkdir [directory-name]
  • Example:

mkdir newfolder

 

๐Ÿ“œ 9. echo – Print text to terminal or file

  • Syntax: echo [text]
  • Example:

echo "Hello World"             # Print text

echo "Hello" > file.txt        # Save text to file

 

๐Ÿ” 10. pwd – Print working directory

  • Syntax: pwd
  • Example:

pwd   # Shows current path

 

๐Ÿ“ฅ 11. man – Show manual/help

  • Syntax: man [command]
  • Example:

man ls   # Shows help for 'ls' command

 

๐Ÿ“ฆ 12. sudo – Execute as superuser

  • Syntax: sudo [command]
  • Example:

sudo apt update    # Run update with admin privileges

 

๐Ÿ” 13. find – Search files

  • Syntax: find [path] -name [pattern]
  • Example:

find /home -name "file.txt"

 

๐Ÿงต 14. grep – Search inside files

  • Syntax: grep [pattern] [file]
  • Example:

bash

grep "hello" file.txt

 

 

Comments

Popular posts from this blog

Application of SQL Commands for Structure Creation and Alteration

Data Types & Expressions