• Home
  • Portfolio
  • Request a Quote
    • Frequently Asked Questions
    • Menumax Module Setup
    • Coding Tips & Tricks
    • About Us
    • Contact Us
    • Bahamas Imported Vehicles Duty Calculator
    • Bahamas Imported Goods Duty Calculator
    • Compound Interest Calculator
    • Compound Interest Calculator With Additional Deposits
    • Mortgage Loan Calculator
    • Body Mass Index & Units Converter
    • Parlay Bets Calculator
    • Percentage Calculator
    • Casino Chips Calculator
    • Free Images
    • Favicon Generator
    • Image Hosting Site
    • W3 HTML Color Groups
    • The Rust Programming Language
  • Blog News
  • Joomla Extensions
  • Bahamas Gas Prices
  • Vehicle Bill of Sale
  • Contact Us

Coding Tips & Tricks

  • Windows command prompts
  • How to Unlock Protected Excel Sheets
  • Common debugging methods available in PHP
  • Command-Line Basics
  • Using Debuggers to Find and Fix Errors in Your Code
  • Common HTML entities
  • Common debugging methods available in Python

Advertisement

EagleProHost.com
EagleProHost.net
  1. You are here:  
  2. Home
  3. Resources
  4. Coding Tips & Tricks

Command-Line Basics

Details
Hits: 551

1. Navigating the File System

Command Platform Use
mkdir Windows, Linux, macOS The shell command mkdir is used to make a new directory in the filesystem according to its argument. In simple terms, it creates a new directory. Example: mkdir new_folder creates a directory named "new_folder" in the current location.
cd Windows, Linux Change the current directory. Example: cd Documents.
dir Windows List the contents of a directory.
ls Linux, macOS List the contents of a directory.
pwd Linux, macOS Print the current directory path.
cd .. Windows, Linux Move up one directory level (to the parent directory).
cd \ Windows Move to the root directory.
cd / Linux, macOS Move to the root directory.
touch Linux, macOS The shell command touch is used to create a new, empty file in the filesystem.
Example: touch example.txt, creates a file named "example.txt" in the current location if it doesn't already exist. If "example.txt" exists, it updates its timestamp.

 

2. Viewing and Changing the File System

Command Platform Use
type Windows Display the contents of a file. Example: type file.txt.
cat Linux, macOS Concatenate and display file contents. Example: cat file.txt.
echo Windows, Linux Output text to the terminal. Example: echo Hello.
ren or rename Windows Rename a file or directory. Example: rename old.txt new.txt.
mv Linux, macOS Move or rename a file/directory. Example: mv old.txt new.txt.
copy Windows Copy a file. Example: copy file.txt backup.txt.
cp Linux, macOS Copy a file. Example: cp file.txt backup.txt.
del Windows Delete a file. Example: del file.txt.
rm Linux, macOS Delete a file. Example: rm file.txt.
mkdir Windows, Linux Create a new directory. Example: mkdir new_folder.
rmdir Windows, Linux Remove an empty directory. Example: rmdir old_folder.

 

3. Redirecting Input and Output

Command Platform Use
> Windows, Linux Redirect output to a file, overwriting it. Example: echo Hello > file.txt.
>> Windows, Linux Redirect output to a file, appending to it. Example: echo World >> file.txt.
| (pipe) Windows, Linux Send output of one command as input to another. Example: dir | find "file".
tee Linux, macOS Write output to both a file and the terminal. Example: ls | tee output.txt.

Page 7 of 7

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

Nassau - New Providence - Bahamas | Phone: +1 (242) 468-7641
Copyright © Eagle Pro Web Design Services. All Rights Reserved.


About Us - Privacy Policy - Cookie Policy - Refund Policy - Terms and Conditions

We use cookies to improve your browsing experience. By continuing to use our website, you consent to the use of cookies in accordance with our cookie policy.

If you have any concerns about our use of cookies, please refer to our cookie policy by clicking on the link below for more information.

Cookie Policy...
  • Webmail Login
Up