Essential Console Commands for Linux, OS X, and their Windows Equivalents

By Łukasz Kallas
Picture of the author
Published on
bash image

Knowing some basic console commands can make your life a lot easier, whether you're using Linux, OS X, or Windows. These commands will help you navigate and manage your system efficiently. In addition, they provide fundamental knowledge for future automation. Here are a few essential console commands for Linux and OS X, along with their Windows equivalents.

  1. ls

The ls command lists the contents of a directory. It's one of the most commonly used commands on Linux and OS X.

ls

Use ls -l to get a detailed list with permissions, file sizes, and modification dates.

ls -l

Windows equivalent: dir

  1. cd

The cd command is used to change directories. This is how you navigate through your file system.

cd /path/to/directory

Use cd .. to move up one directory level.

cd ..
  1. pwd

The pwd command stands for "print working directory." It displays the current directory path.

pwd

Windows equivalent: cd

  1. mkdir

The mkdir command creates a new directory.

mkdir new_directory
  1. rm

The rm command removes files or directories. Be careful with this command, as it permanently deletes files. `

rm file.txt

To remove a directory and its contents, use rm -r.

rm -r directory_name

Windows equivalent: del (for files) and rmdir (for directories)

  1. cp

The cp command copies files or directories.

cp source_file destination_file

To copy a directory and its contents, use cp -r.

cp -r source_directory destination_directory

Windows equivalent: copy (for files) and xcopy (for directories)

  1. mv

The mv command moves or renames files and directories.

To move a file:

mv source_file destination_directory

To rename a file:

mv old_name new_name

Windows equivalent: move and ren

  1. cat

The cat command concatenates and displays the content of files.

cat file.txt

Windows equivalent: type


Mastering these will give you a strong foundation for more advanced console tasks.

Stay Tuned

Want to learn?
The best articles, links and news related to software development delivered once a week to your inbox.