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

Was this helpful?

Edit on GitHub
  1. Courses
  2. TCM - Linux 101
  3. 2. Command Line

Command Line Arguments and Options

  • Some options can be specified by a single dash and a single character, other options require two dashes and a multi-character (verbose) description.

  • Formats can also be combined, by following some rules:

    • one character options can be merged

    • multi-character formats cannot be combined

ls command example

ls --help
	Usage: ls [OPTION]... [FILE]...
	List information about the FILEs (the current directory by default).
	Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.
	
	Mandatory arguments to long options are mandatory for short options too.
	  -a, --all                  do not ignore entries starting with .
	  -A, --almost-all           do not list implied . and ..
	[...]
	  -I, --ignore=PATTERN       do not list implied entries matching shell PATTERN
	  -k, --kibibytes            default to 1024-byte blocks for disk usage;
	                               used only with -s and per directory totals
	  -l                         use a long listing format
	  -L, --dereference          when showing file information for a symbolic
	                               link, show information for the file the link
	                               references rather than for the link itself
	  -m                         fill width with a comma separated list of entries
	  -n, --numeric-uid-gid      like -l, but list numeric user and group IDs
	[...]
  • ls -al - Single character options:

ls -al
	total 100
	drwxr-x--- 16 user user 4096 ago 28 15:15 .
	drwxr-xr-x  3 root root 4096 lug 24 15:19 ..
	-rw-------  1 user user  829 ago  8 10:44 .bash_history
	-rw-r--r--  1 user user  220 lug 24 15:19 .bash_logout
	-rw-r--r--  1 user user 3771 lug 24 15:19 .bashrc
	drwx------ 12 user user 4096 ago 28 14:41 .cache
	drwx------ 12 user user 4096 ago 28 14:41 .config
	drwxr-xr-x  2 user user 4096 lug 24 15:37 Desktop
	drwxr-xr-x  2 user user 4096 lug 24 15:37 Documents
	drwxr-xr-x  3 user user 4096 lug 24 15:59 Downloads
	drwx------  2 user user 4096 ago 28 15:38 .gnupg
	-rw-------  1 user user   20 ago 28 15:15 .lesshst
	drwx------  3 user user 4096 lug 24 15:37 .local
	drwxr-xr-x  2 user user 4096 lug 24 15:37 Music
	drwxr-xr-x  2 user user 4096 lug 24 15:37 Pictures
	-rw-r--r--  1 user user  807 lug 24 15:19 .profile
	drwxr-xr-x  2 user user 4096 lug 24 15:37 Public
	drwx------  4 user user 4096 lug 24 15:59 snap
	drwx------  2 user user 4096 lug 24 15:40 .ssh
	-rw-r--r--  1 user user    0 lug 24 15:37 .sudo_as_admin_successful
	drwxr-xr-x  2 user user 4096 lug 24 15:37 Templates
	-rw-r-----  1 user user    5 ago 28 14:41 .vboxclient-clipboard.pid
	-rw-r-----  1 user user    5 ago 28 14:41 .vboxclient-display-svga-x11.pid
	-rw-r-----  1 user user    5 ago 28 14:41 .vboxclient-draganddrop.pid
	-rw-r-----  1 user user    5 ago 28 14:41 .vboxclient-seamless.pid
	drwxr-xr-x  2 user user 4096 lug 24 15:37 Videos
  • ls --all -l - Multi character options:

# Same output
ls --all -l
	total 100
	drwxr-x--- 16 user user 4096 ago 28 15:15 .
	drwxr-xr-x  3 root root 4096 lug 24 15:19 ..
	-rw-------  1 user user  829 ago  8 10:44 .bash_history
	-rw-r--r--  1 user user  220 lug 24 15:19 .bash_logout
	-rw-r--r--  1 user user 3771 lug 24 15:19 .bashrc
	drwx------ 12 user user 4096 ago 28 14:41 .cache
	drwx------ 12 user user 4096 ago 28 14:41 .config
	drwxr-xr-x  2 user user 4096 lug 24 15:37 Desktop
	drwxr-xr-x  2 user user 4096 lug 24 15:37 Documents
	drwxr-xr-x  3 user user 4096 lug 24 15:59 Downloads
	drwx------  2 user user 4096 ago 28 15:38 .gnupg
	-rw-------  1 user user   20 ago 28 15:15 .lesshst
	drwx------  3 user user 4096 lug 24 15:37 .local
	drwxr-xr-x  2 user user 4096 lug 24 15:37 Music
	drwxr-xr-x  2 user user 4096 lug 24 15:37 Pictures
	-rw-r--r--  1 user user  807 lug 24 15:19 .profile
	drwxr-xr-x  2 user user 4096 lug 24 15:37 Public
	drwx------  4 user user 4096 lug 24 15:59 snap
	drwx------  2 user user 4096 lug 24 15:40 .ssh
	-rw-r--r--  1 user user    0 lug 24 15:37 .sudo_as_admin_successful
	drwxr-xr-x  2 user user 4096 lug 24 15:37 Templates
	-rw-r-----  1 user user    5 ago 28 14:41 .vboxclient-clipboard.pid
	-rw-r-----  1 user user    5 ago 28 14:41 .vboxclient-display-svga-x11.pid
	-rw-r-----  1 user user    5 ago 28 14:41 .vboxclient-draganddrop.pid
	-rw-r-----  1 user user    5 ago 28 14:41 .vboxclient-seamless.pid
	drwxr-xr-x  2 user user 4096 lug 24 15:37 Videos
  • ls -I - use ignore pattern option:

# Ignore all entries that starts with the letter D:

ls -I "D*"
	Music  Pictures  Public  snap  Templates  Videos

ls --ignore="D*"
	Music  Pictures  Public  snap  Templates  Videos

📌 Pay attention to option arguments when combining more single character options. It is better to use the long format option.


PreviousGetting help on the Command LineNextReading Text Files

Last updated 2 years ago

Was this helpful?