TCM Security Academy Notes - by syselement
🏠 Home BlogGitHub📚 Buy Me a Book
  • TCM Security Academy Notes
  • Courses
    • TCM - Linux 101
      • 1. Introduction
        • Linux Distributions
        • Installing Linux
      • 2. Command Line
        • Intro to Command Line
        • Getting help on the Command Line
        • Command Line Arguments and Options
        • Reading Text Files
      • 3. File System
        • Filesystem Hierarchy Standard
        • Devices, Partitions and Mounting
        • Absolute and Relative Paths
        • Files and Directories
        • Paths, Filenames and Text Files
        • Filesystem Links
        • Archiving and Searching Files
      • 4. Users and Groups
        • Working with Users and Groups
        • File and Directory Permissions
        • Changing Users and Passwords
      • 5. Installing Software
        • Package Management
      • 6. Shells
        • Common Command Line Shells
        • Environment Variables & Startup Files
        • Input/Output Redirection
        • Command History & Substitution
      • 7. Utilities and File Editors
        • Searching and Processing Text
        • Networking at the Command Line
        • File Transfer
        • Text Editors and Converters
      • 8. Process Management
        • Process Information
        • Foreground and Background Processes
        • Managing Processes
        • Scheduling Processes
      • 9. Regular Expressions
        • Regular Expressions, Searching, Replacing, Building
      • 10. Bash Scripting
        • Bash Scripting Basics, Control Structures, Loops
      • 🌐Linux101 References
    • TCM - Mobile Application Penetration Testing
      • 1. Introduction & Mobile Pentesting
      • 2. Android Security
      • 3. Android Lab Setup
      • 4. Android Static Analysis
      • 5. Android Dynamic Analysis
      • 6. Android Bug Bounty
      • 7. iOS Security
      • 8. iOS Lab Setup
      • 9. iOS Static Analysis
      • 10. iOS Dynamic Analysis
      • 11. iOS Bug Bounty
      • 🌐MAPT References
    • TCM - Practical Ethical Hacking
      • 1. Introduction & Networking
      • 2. Lab Set Up, Linux & Python
        • Intro to Kali Linux
        • Intro to Python
      • 3. The Ethical Hacker Methodology
        • Information Gathering
        • Scanning & Enumeration
        • Vulnerability Scanning with Nessus
        • Exploitation Basics
        • Capstone Practical Labs
      • 4. Active Directory
        • Active Directory Lab
        • AD - Initial Attack Vectors
        • AD - Post-Compromise Enumeration
        • AD - Post-Compromise Attacks
        • AD - Additional Attacks
        • AD - Case Studies
      • 5. Post Exploitation
      • 6. Web Application
        • Web App Lab Setup
        • Web App - SQL Injection
        • Web App - XSS
        • Web App - Command Injection
        • Web App - Insecure File Upload
        • Web App - Authentication Attacks
        • Web App - XXE
        • Web App - IDOR
        • Web App - Capstone Practical Lab
      • 7. Wireless Attacks
      • 8. Legal Documentation & Report Writing
      • 🌐PEH References
  • 🏠syselement's Blog Home
Powered by GitBook
On this page
  • Commands
  • file
  • dos2unix
  • Editors
  • nano
  • vim

Was this helpful?

Edit on GitHub
  1. Courses
  2. TCM - Linux 101
  3. 7. Utilities and File Editors

Text Editors and Converters

  • There is a difference between text files in Windows, MacOS and Linux.

    • The end of the line in text files is a different character for each O.S - the line terminator.

      • Win - \n

      • MacOS - (control)

      • Linux - (line feed)

Commands

file

  • file - determine file type

# Check the line terminators
file sample_win.txt sample_mac.txt sample_unix.txt
    sample_win.txt: ASCII text, with CRLF line terminators
    sample_mac.txt: ASCII text, with CR line terminators
    sample_unix.txt: ASCII text
  • Converting files with dos2unix/unix2dos tools:

dos2unix

  • dos2unix / unix2dos

sudo apt install dos2unix

# Convert unix file to dos new file
unix2dos -n sample_unix.txt temp.txt
    unix2dos: converting file sample_unix.txt to file temp.txt in DOS format...
file temp.txt
	temp.txt: ASCII text, with CRLF line terminators

unix2dos -c mac sample_unix.txt
	unix2dos: converting file sample_unix.txt to Mac format...
file sample_unix.txt
    sample_unix.txt: ASCII text, with CR line terminators

# Convert dos file to unix file
dos2unix sample_dos.txt
	dos2unix: converting file sample_dos.txt to Unix format...
file sample_dos.txt
	sample_dos.txt: ASCII text

Editors

nano

  • nano - small editor

    • pening multiple files, scrolling per line, undo/redo, syntax coloring, line numbering, and soft-wrapping overlong lines.

nano example.txt

# Shortcuts are deisplayed at the bottom of the screen
# ^ = press CTRL + specified short key
# M- = press ALT + specified short key
  • Press CTRL+G to enter the Help menu

  • Press ALT+X to disable Help mode

  • Scroll with PgUp and PgDown keys

  • Press CTRL+C to find the cursor location

  • Undo a change with ALT+U

  • ALT+A start a selection at the current cursor location and move the cursor

  • ALT+6 to copy the selected text

  • CTRL+U to paste the copied text

  • CTRL+W to search content - ALT+W/ALT+Q to keep searching for the same content

  • CTRL+O to save file

  • CTRL+X to exit file

vim

  • vim - Vi IMproved text editor

WHAT
PREPEND
EXAMPLE

Normal mode command

:help x

Visual mode command

v_

:help v_u

Insert mode command

i_

:help i_<Esc>

Command-line command

:

:help :quit

Command-line editing

c_

:help c_<Del>

Vim command argument

-

:help -r

Option

'

:help 'textwidth'

Regular expression

/

:help /[

vim example.txt
# Vim opens in the command mode
  • Press i for insert mode

  • Press ESC key to exit insert mode

  • Exit vim with :q

  • Exit without save with :q!

  • Save and exit with :wq

  • Search with /text_to_search

    • n/Nto scroll through searching


PreviousFile TransferNext8. Process Management

Last updated 2 years ago

Was this helpful?

📌 Check the for more advanced Vim functionalities.

VimHelp manual
Nano Keyboard Shortcuts - by bipinthite
VIM Cheat Sheet - by typo209