TI 05 - Linha de Comandos - parte 1

Command Line Basics

Introduction to Command Line

  • Command line interface allows users to interact with the operating system using textual commands.

  • Interfaces available: File Explorer (GUI) and Command Prompt (cmd) or PowerShell.

  • Cmd is typically used for simpler tasks whereas PowerShell is more advanced but requires more learning.

Setting Up the Environment

  • File Explorer Configuration: Enable file extensions and hidden files visibility to avoid confusion.

  • Use function keys (F2) to rename files; if these are set to control (e.g., brightness), use FN key or BIOS settings to change.

Command Syntax and Navigation

Command Prompt Basics

  • Starting Command Prompt: Type cmd in the TaskBar search.

  • Change Directory: Use cd to change directories. E.g., cd C:\workClasses\TI 2122SI.

  • Prompt Characteristics: Displays current working directory followed by > symbol.

Understanding Paths

  • Absolute Path: Starts from the root directory (C:\). Example: C:\directory\subdirectory.

  • Relative Path: Starts from the current directory.

    • . means current directory.

    • .. means parent directory.

Commands for Directory Management

  • DIR Command: Lists files and directories.

    • DIR /A:D: List only directories.

    • DIR /B: Bare format, omitting headers.

  • Create Directory: md or mkdir creates a new directory.

  • Remove Directory: rd or rmdir removes a directory if it's empty.

Moving Between Drives

  • Changing drives is done by typing the drive letter followed by :. E.g., D:.

  • Change Directory Across Drives: Use cd /d to switch drives and directories simultaneously.

File Management Commands

Copying, Moving, and Deleting Files

  • Copy: copy source destination to copy files.

  • Delete: del filename or erase filename to delete files.

  • Move: move source destination to move files from one location to another.

  • Rename: ren old_name new_name to rename files.

Viewing and Editing File Content

  • Type: type filename to display file content in the command line.

File Attributes

Understanding File Attributes

  • Directory (D): Indicates entry is a directory.

  • Read-only (R): Prevents modifying the file.

  • Hidden (H): Files not shown in standard directory listings.

  • System (S): Indicates a system file, typically hidden.

  • Archive (A): The file has been modified and is ready for backup.

Changing File Attributes

  • Command to alter file attributes: attrib. E.g., attrib +R filename makes a file read-only.

Advanced Features

Using Wildcards in Filenames

  • Wildcards: ? represents a single character, * represents zero or more characters.

    • Example: dir LEI?.pdf lists files like LEIM.pdf.

Environment Variables

  • Variables: Used by cmd and applications, can be viewed using the set command.

  • Path Variable: Defines directories that cmd checks for executables.

  • Example: When entering a command, if the executable is not found in the current directory, cmd will check the directories listed in the Path variable.

Programming Basics

Java Programming Overview

  • Java Development Kit (JDK): Contains tools for developing, compiling, and executing Java code.

  • Java Virtual Machine (JVM): Executes compiled Java bytecode.

Java Compilation Steps

  1. Edit: Write code in a .java file.

  2. Compile: Use javac filename.java to compile to bytecode (.class file).

  3. Execute: Run the program with java filename (omit .class).

Kotlin Similarities

  • Kotlin also follows similar steps: Edit, Compile, Test using corresponding tooling.