🐧
Linux
  • Introduction
  • 🖇️general
    • essentials
    • other commands
    • Superuser-do (sudo)
    • SUID, SGID, sticky bit
    • /dev/null
    • environment variables
    • special variables
    • shebang
  • spool
  • 🔧bash
    • overview
    • redirection
    • loop
    • .bashrc
  • text processing
    • grep
    • sed
    • awk
  • xxd/hexdump
  • text editors
    • nano
    • vi/vim
  • 📂filesystem & directories
    • Filesystem Hierachy Standard (FHS)
      • /etc
        • hosts, hosts.allow, hosts.deny
        • /cron.d
        • /httpd
        • /samba.d
        • hostname
        • crontab
        • shadow
        • passwd
        • profile
        • services
      • /dev
      • /proc
        • version
      • /mnt
      • /opt
      • /sbin
      • /lib
      • /usr
      • /tmp
      • /var
      • /bin
      • /run
    • chroot
  • find
  • locate
  • ⌚processes & jobs
    • cronjob
    • daemon
  • ⛓️system
    • systemctl
    • hostname
    • systemd
  • 🗃️media
    • ffmpeg
    • pdftk
  • 🔒Security
    • ufw
  • firejail
  • apparmor
  • 📦Package management
    • dpkg
    • apt/apt-get
  • Storage
    • lsblk
    • mount/umount
  • df/du
  • user management
    • chsh
  • Networking
    • Introduction
    • routing table/interface management
    • /etc/hosts, /etc/hosts.allow, /etc/hosts.deny
Powered by GitBook
On this page
  • ls
  • pwd
  • cd
  • mkdir
  • cat
  1. general

essentials

In this section, I will be discussing some basic Linux commands, along with a few basic flags associated with each commands. The term flag refers to the arguments/parameters supplied to the command.

apt, apt-get, file, diff

ls

Lists contents in specified directory. If <dir> value is omitted, the current directory would be used instead

$ ls <dir>
Desktop Downloads Documents 
Public Pictures ...

Useful flags

-l

To display content in long listing format

$ ls -l 

-a, --all

To display all content including those starting with . (hidden files)

$ ls -a 

Combination of multiple flags

  • Display all content including hidden files (starting with .), in long listing format

$ ls -la 

pwd

To print the current working directory

user@linux:~/$ pwd
/home/user

cd

To change directory

$ cd <dir>

Basic example

# print the current working directory
user@linux:~/$ pwd
/home/user

# change directory
user@linux:~/$ cd test_dir

# pwd displays the updated directory
user@linux:~/test_dir$ pwd
/home/user/test_dir

mkdir

To create a new directory

$ mkdir <new_dir>

# example
user@linux:~/$ mkdir test_dir
user@linux:~/$ cd test_dir
user@linux:~/test_dir$ 

cat

From manpage: "concatenate files and print on standard output". In simple terms, it displays the content of a particular input file

$ cat test_file.txt
here is a test file
next line here

Useful flags

-n, --number

To display output line numbers

$ cat -n test_file.txt
1 here is a test file
2 next line here

$ cat ---number test_file.txt
1 here is a test file
2 next line here

PreviousIntroductionNextother commands

Last updated 3 months ago

🖇️