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
cmdin the TaskBar search.Change Directory: Use
cdto 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:
mdormkdircreates a new directory.Remove Directory:
rdorrmdirremoves 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 /dto switch drives and directories simultaneously.
File Management Commands
Copying, Moving, and Deleting Files
Copy:
copy source destinationto copy files.Delete:
del filenameorerase filenameto delete files.Move:
move source destinationto move files from one location to another.Rename:
ren old_name new_nameto rename files.
Viewing and Editing File Content
Type:
type filenameto 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 filenamemakes a file read-only.
Advanced Features
Using Wildcards in Filenames
Wildcards:
?represents a single character,*represents zero or more characters.Example:
dir LEI?.pdflists files likeLEIM.pdf.
Environment Variables
Variables: Used by cmd and applications, can be viewed using the
setcommand.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
Edit: Write code in a
.javafile.Compile: Use
javac filename.javato compile to bytecode (.classfile).Execute: Run the program with
java filename(omit.class).
Kotlin Similarities
Kotlin also follows similar steps: Edit, Compile, Test using corresponding tooling.