Linux CLI (Level 1)
FUN WITH LINUX COMMAND LINE
This is a list of command line (CLI) functions you can use on *most Unix style systems. This list is more for the beginners looking to get something done from a command line. These are pretty basic and really not that exciting.
*Note some of these commands are specific to the bash shell or Operating System Distro.
# -- Copying and Moving Files -- #
-
# Copy a file
-
$ cp filename filename.backup
-
-
# Shortcut or the same command
-
$ cp filename{,.backup}
-
-
# Move a file
-
$ mv filename filename.backup
-
-
# Shortcut or the same command
-
$ mv filename{,.backup}
# -- grep commands -- #
-
# Search log files directory for "something"
# -- Navigation -- #
-
$ cd path
-
# Navigate directory via command line
-
-
$ cd ~
-
# Return to home directory
-
-
$ cd -
-
# Go back to last directory
-
-
$ mc
-
# Command line "GUI" Midnight Commander
-
-
$ tree
-
# Hierarchical display
# -- VI fun -- #
-
# To edit multiple files in vi
-
:split filename
-
-
# If you don't know the name of the
-
# other file you want to edit you can use this sequence
-
:split # to open another session
-
edit . # to navigate to another file. (Notice the period after the edit command)
-
-
# Or a shortcut of
-
:split.
-
-
# When editing multiple files you switch between each file by
-
# hitting <ctrl> ww
# -- System Commands -- #
-
$ top
-
# Displays dynamic real-time view of a running system
-
# Additional trick from within top, is you type ? you
-
# get a list of commands you can run within top
-
-
$ uptime
-
# Tells how long the system has been running
-
-
$ kill PID
-
# Kills the application association with the PID number defined
-
-
$ kill -9 PID
-
# When a normal kill wont do the job, the switch -9
-
# forces the system to kill a process
-
-
$ df -h
-
# Reports filesystem disk space usage. The switch -h makes
-
# it "Human Readable"
-
-
$ du -h --max-depth=2
-
# Estimates file space usuage. -h makes it "Human Readabl"
-
# and the -max-depth=2 only executes the commands down 2 levels.
# Command line applications
-
$ lynx
-
# Command line web browser
-
-
$ pine
-
# Command line email reader
-
-
$ mutt
-
# Another Command line email reader
# -- Misc -- #
-
$ man command
-
# Gives you the manual pages for a specified command (example man cp)
-
-
$ cal
-
# Displays a Calendar
-
-
$ cal -3
-
# Displays Previous, Current, and Next month calendars
-
-
$ date
-
# Display current time and date
-
-
$ whereis program
-
# Searches common locations for the program
-
-
$ whatis program
-
# A short synopsis of what a program is.
-
-
$ locate
-
# Find a files location via internal database
-
-
$ find / -name filename
-
# A manual search for a file. In this case the
-
# first argument of / (slash) means the entire system.
-
# Searches can be narrowed down by define a path in this
-
# place such as /home
# -- OTHER IMPORTANT COMMANDS WORTH DOING A 'man' ON -- #