Skip to main content

Essential Unix Terminal Commands: A Handy Guide for Beginners πŸ–₯️

 


If you're working in a Unix-like environment (like Linux or macOS), mastering the command line is key to unlocking the full potential of your system. The terminal allows you to perform powerful operations by executing commands directly. In this guide, we’ll cover some of the most commonly used Unix terminal commands to help you get started!


1. alias – Create Shortcuts for Commands πŸ”—

The alias command allows you to create shortcuts for longer commands, making them easier to type and remember.

alias ll='ls -la'

Here, ll is now an alias for ls -la. You can create any alias you like to save time.


2. at – Schedule a Command for Later ⏰

The at command lets you schedule a command to run at a specified time.

at 5:00 PM

Enter the command you want to run at 5:00 PM, press Ctrl+D to schedule it.


3. cal – Display a Calendar πŸ“…

The cal command displays a calendar for the current month. You can specify a year to view its entire calendar.

cal 2024

4. cat – Concatenate and Display Files πŸ“œ

The cat command is used to display the contents of a file, combine multiple files, or create new files.

cat file.txt

5. cd – Change Directory πŸ“‚

The cd command is used to navigate between directories.

cd /path/to/directory

Use cd .. to move up one directory.


6. chmod – Change File Permissions πŸ”‘

The chmod command changes the permissions of files or directories.

chmod 755 file.sh

Here, 755 sets the permissions (rwx for owner, rx for group and others).


7. chown – Change File Ownership πŸ‘€

The chown command changes the owner and/or group of a file.

chown user:group file.txt

8. cksum – Display File Checksum and Size πŸ”’

The cksum command calculates and displays the checksum and size of a file.

cksum file.txt

9. clear – Clear the Terminal Screen 🧼

The clear command simply clears the terminal screen.

clear

10. cmp – Compare Two Files πŸ†š

The cmp command compares two files byte by byte and shows the first difference.

cmp file1.txt file2.txt

11. cp – Copy Files or Directories πŸ“

The cp command copies files or directories from one location to another.

cp source.txt destination.txt

Use cp -r to copy directories recursively.


12. date – Display or Set the System Date and Time ⏳

The date command shows the current date and time.

date

You can also set the date (requires superuser privileges).


13. df – Display Disk Space Usage πŸ’½

The df command displays disk space usage for file systems.

df -h

The -h flag shows output in a human-readable format.


14. diff – Compare Files Line by Line πŸ“‘

The diff command compares two files line by line and outputs the differences.

diff file1.txt file2.txt

15. du – Display Directory Size πŸ“

The du command displays the size of files and directories.

du -sh /path/to/directory

The -s flag gives a summary, and -h makes the output human-readable.


16. env – Display Environment Variables 🌎

The env command displays all the environment variables of the current shell session.

env

17. find – Search for Files and Directories πŸ”

The find command searches for files and directories based on various criteria.

find /path/to/search -name "file.txt"

18. hexdump – Display File Contents in Hexadecimal Format πŸ”’

The hexdump command shows the hexadecimal representation of a file's contents.

hexdump file.txt

19. history – View Command History πŸ“œ

The history command shows the history of commands you’ve entered in the terminal.

history

20. kill – Terminate a Process πŸ’€

The kill command sends a signal to terminate a process. You'll need the process ID (PID).

kill 1234

You can find the PID using the ps command.


21. ls – List Directory Contents πŸ“‚

The ls command lists the files and directories in the current directory.

ls -la

The -l flag shows detailed information, and -a includes hidden files.


22. man – Display Manual Pages πŸ“–

The man command shows the manual for any Unix command.

man ls

23. mkdir – Create a New Directory πŸ“

The mkdir command creates a new directory.

mkdir new_folder

24. mv – Move or Rename Files/Directories 🚚

The mv command moves or renames files or directories.

mv old_name.txt new_name.txt

25. od – Output File Contents in Different Formats πŸ—‚️

The od command outputs the contents of a file in octal, hexadecimal, or ASCII format.

od -x file.txt

26. ps – Display Running Processes πŸ“‹

The ps command shows a list of running processes.

ps aux

Use ps aux to see detailed information about all processes.


27. Process Flags 🏴

Process flags are used with commands like ps to filter and display specific information about processes:

  • -e: Show all processes.
  • -f: Show full format.
  • -u: Display user-owned processes.
  • -x: Include processes without controlling terminals.

28. pwd – Print Working Directory πŸ“

The pwd command prints the current directory you're in.

pwd

29. rm – Remove Files or Directories πŸ—‘️

The rm command removes files or directories.

rm file.txt

Use rm -r to remove directories recursively.


30. rmdir – Remove an Empty Directory πŸ—‘️

The rmdir command removes an empty directory.

rmdir old_folder

31. sort – Sort Lines of Text πŸ“‘

The sort command sorts the lines in a file.

sort file.txt

32. tee – Read from Standard Input and Write to a File πŸ“

The tee command reads input from stdin and writes it to both a file and the terminal.

echo "Hello" | tee file.txt

Conclusion 🏁

These Unix terminal commands are just the tip of the iceberg, but they offer a solid foundation for navigating, managing, and manipulating files and processes in a Unix-like operating system. By mastering these commands, you’ll be able to work more efficiently and confidently in any Unix environment!

Let me know if you have any questions or want to learn more advanced commands! πŸš€

Comments

Popular posts from this blog

Unraveling the Apache Hadoop Ecosystem: The Ultimate Guide to Big Data Processing πŸŒπŸ’ΎπŸš€

In the era of big data, organizations are constantly seeking efficient ways to manage, process, and analyze large volumes of structured and unstructured data. Enter Apache Hadoop , an open-source framework that provides scalable, reliable, and distributed computing solutions. With its rich ecosystem of tools, Hadoop has become a cornerstone for big data projects. Let’s explore the various components and layers of the Hadoop ecosystem and how they work together to deliver insights. Data Processing Layer πŸ› ️πŸ” The heart of Hadoop lies in its data processing capabilities, powered by several essential tools: Apache Pig 🐷 : Allows Hadoop users to write complex MapReduce transformations using a scripting language called Pig Latin , which translates to MapReduce and executes efficiently on large datasets. Apache Hive 🐝 : Provides a SQL-like query language called HiveQL for summarizing, querying, and analyzing data stored in Hadoop’s HDFS or compatible systems like Amazon S3. It makes inter...

Understanding Cloud Computing: SaaS, PaaS, IaaS, and DaaS Explained ☁️πŸ’»πŸš€

 In today’s digital world, cloud computing has revolutionized the way businesses and individuals store, access, and manage data and applications. From reducing the burden of software management to providing scalable platforms for app development, the cloud offers a wide range of services tailored to different needs. Let’s dive into the most common cloud services: SaaS, PaaS, IaaS, and DaaS . 1. SaaS – Software as a Service πŸ–₯️✨ SaaS is the most recognizable form of cloud service for everyday consumers. It takes care of managing software and its deployment, making life easier for businesses by removing the need for technical teams to handle installations, updates, and licensing. πŸ”‘ Key Benefits : Cost Reduction : No need for a dedicated IT team or expensive licensing fees. Ease of Use : Access software directly through the internet without complex setup. πŸ› ️ Popular SaaS Applications : Salesforce : A leading CRM platform that helps businesses manage customer relationships. Google ...

Springboot Simple Project - Student Results Management System

My project is a Student Results Management System . It involves managing students and their results for different subjects. The key components of my project are: Entities : Student and Result Repositories : Interfaces for data access Services : Business logic layer Controllers : REST APIs for handling HTTP requests Configuration : Database and other configurations 1. Entities Entities represent the tables in your database. Let's look at your entities and understand the annotations used. Student Entity : Annotations : @Entity : Marks the class as a JPA entity. @Table(name = "students") : Specifies the table name in the database. @Id : Denotes the primary key. @GeneratedValue(strategy = GenerationType.IDENTITY) : Specifies the generation strategy for the primary key. @OneToMany(mappedBy = "student", cascade = CascadeType.ALL, orphanRemoval = true) : Defines a one-to-many relationship with the Result entity. The mappedBy attribute indicates that the student fiel...