PCLinuxOS New User Guide : BasicCliCommand

HomePage :: PCLinuxOS Forum | Index | Categories | Changes | Login/Register
Most recent edit on 2007-05-06 22:58:18 by SySy [moved]

Additions:
moved to http://docs.mypclinuxos.com/index.php?title=CLI

Deletions:

Basic CLI command

Back to Contents
CLI, or Command Line Interface, is also called shell or terminal. The standard shell used is bash. You can start a bash session by selecting the Konsole icon.

Before we get into cli commands we first need to understand bash notations

/ - root directory

./ - current directory

./command_name - run a command in the current directory when the
current directory is not on the path

../ - parent directory

~ - home directory

$ - typical prompt when logged in as ordinary user

# - typical prompt when logged in as root or superuser

Also we need to understand a few keyboard shortcuts

[Tab][Tab] or [Esc][Esc] - prints a list of all available commands.

x[Tab][Tab] or x[Esc][Esc] - prints a list of all available completions for a
command, where the beginning is``x

[Alt][Ctrl][F1]-[F6] - switch to the virtual text console

[Alt][Ctrl][F7]-[F12] - switch to the GUI console, if there is
one running.

[Arrow Up] - scroll through the command history

[Shift][Page Up] - scroll terminal output up.

[Shift][Page Down] - scroll terminal output down

[Ctrl][Alt][Bk Spc] - kill the current X server. Used when normal
exit is not possible.

[Ctrl][Alt][Del] - shut down the system and reboot

[Ctrl]c - kill the current process

[Ctrl]d - logout from the current terminal

[Ctrl]s - stop transfer to current terminal

[Ctrl]q - resume transfer to current terminal. This should be
tried if the terminal stops responding.

[Ctrl]z - send current process to the background

List of Linux Bash Commands


access - determine whether a file can be accessed
Usage: access -MODE FILE
MODE is one or more of rwx. Exit successfully if FILE exists
and is readable (r), writable (w), or executable (x).

adduser - used by root to add user to system
Usage: useradd [options] LOGIN

agetty - enables login on terminals.
Usage: agetty [-hiLmw] [-l login_program] [-t timeout] [-I initstring]
[-H login_host] baud_rate,... line [termtype] or [-hiLmw]
[-l login_program] [-t timeout] [-I initstring] [-H login_host]
line baud_rate,... [termtype]

ark - create, modify and extract from archives
Usage: Calls Gui Ark

arch - print machine architecture type

bash - Bourne again shell. This is the default shell
Usage: bash [GNU long option] [option] ...
bash [GNU long option] [option] script-file ...
Type `bash -c "help set"' for more information about shell options.
Type `bash -c help' for more information about shell builtin
commands.

bunzip2 - used to uncompress files compressed with bzip2
usage: bunzip2 [flags and input files in any order]

bzip2 - compresses with algorithm different from gzip
usage: bzip2 [flags] file name

bzless - view bzipped files
usage: bzless /folder/foo.txt.bz

bzcat - view bzipped files
Usage: bzcat /folder/foo.txt.bz

cd - change working directory.
Usage: cd dir

cfdisk - hard drive partion configurator
Usage: cfdisk

chgrp - changes group associated with file. Can be used to change the
group associated with subdirectories and files of a directory.
usage: chgrp group files or: chgrp -R group files

chkconfig - Query or update system services/daemons for different runlevels.

chmod - set permissions (modes) of files or directories.
A value of 4 is used for read permission.
A value of 2 is used for write permission.
A value of 1 is used for execute permission.

chown - changes ownership of a file. Can be used recursively.
usage: chown userid files
or: chown -R userid files

clear - clear screen command
usage: clear


cmp - compares two files for differences
usage: cmp file1 file2
cmp /etc/X11/xorg.conf /etc/X11/xorg.conf.old

cp - copies on or more files. Recursive copying is one simple way
of archiving part of a directory structure. Use the command as follows:
cp -r /sourcedirectory /targetdirectory

date - displays or sets date and time
usage: date

diff - displays differences between two files
usage: diff file1 file2 (same as cmp)

dmesg - displays messages from /var/log relative to the most recent boot
Usage: dmesg [-c] [-n level] [-s bufsize]

e2fsck - check an ext2 filesystem. The syntax is e2fsck /dev/devicename
where the filesystem is on /dev/devicename. The device should not
be mounted, and this program must be run as root.

echo - write arguments to standard output. One use is to print
out information about environment variables, as in
echo $PATH - list paths to search
echo $HOME or echo ~ - list name of home directory

egrep - search files for lines that match regular expressions.
Runs faster than grep and fgrep.

exit - exit a shell. This is a shell builtin.

fdformat - low level format of a floppy device

file - displays classification of a file or files according to the type of
data they contain

find - find files according to a large variety of search criteria.
The find command that I use the most is
find . -name filename -print

grep - used to find a string within a file. The -i option returns matches
without regard to case. The -n option means that each line of
output is preceded by file name and line number. The -v option
causes non-matched lines to be printed.
usage: grep pattern files
or: grep -i pattern files
or: grep -n pattern files
or: grep -v pattern files

groupadd - create a new group on the system

groups - shows which groups you are in

gunzip - used to uncompress files compressed with gzip

gzip - used to compress or decompress files

halt - immediately shut down system as root, without reboot

history - command for viewing and manipulating the shell
command history list

ifconfig - display (as root) information on network interfaces that
are currently active. First ethernet interface should be
listed as eth0, second as eth1, etc. First modem ppp
connection should be listed as ppp0, etc. The ``lo
connection is ``loopback only.

ifdown - shut down the network interface

ifup [interface_name] - start up the interface

insmod - used (by root) to install modular device drivers

kill - sends a signal to (especially to terminate) a job or process.
This is a shell builtin in bash,tcsh and zsh.

killall - kill processes by name. Kill all processes which are instances
of the speciffied program. Also used to send signals to processes or
restart them.

killall5 - kill all processes except the ones on which it depends

less - Linux alternative to ``more
command. Displays text files, one
screenful at a time. When less pauses, there is a large number of
available commands to tell it what to do next. One can scroll both
forwards and backwards.

ln - creates a link to a file. Used to create hard links and, with the -s
option, symbolic links which can link files on different disk partitions.
The syntax is - ln [options] source [dest]

logout - execute logout as individual user and bring up login: prompt

ls - list directory contents.

lsmod - used (by root) to show kernel modules currently loaded

lspci - utility to display information on pci buses and hardware
devices attached to them.

man - displays information from online Unix reference manual

mkdir - create a directory

mkfs - create a file system (format) on a device or partition.
Should be invoked after lowlevel formatting of the disk
using fdformat. It has several versions which are all links
to the basic program, such as mkfs.ext2

more - list file contents, stopping after each full screen

mount - mount device using filesystem of type [fstype] with device name
[device] at the location [mountpoint] in the filesystem directory tree
mount -a - mount all filesystems according to the specifications
in /etc/fstab

mv - moves (renames) files
usage: mv [src] [dest]

passwd - change login password

pwd - print absolute path of working directory. This is a shell builtin.

reboot - reboots the system. Seems to be equivalent to shutdown -r now

rm - remove files or directories. With the -r (recursive) option
(very dangerous!), can be used to remove the contents of a
specified directory including all subdirectories.

rmdir - remove empty directories

showmount - show information about an nfs server

shutdown - reboot or shut down system as root, after specified
amount of time. With the -r option, reboot. With
the -h option, halt the system.
usage: shutdown -r minutes

startx - front end to xinit in Linux. This is a script which starts
up X clients and shuts down the X server on exit from
the window manager

su - log in as another user, including root

sudo - allows individual users to have root permission to perform
specified tasks

umount [device] - finish writing to the device and remove it from
the active filesystem.
The command umount -a will (re)mount all file systems
listed in /etc/fstab.

unzip - uncompress files compressed with the zip utility,
compatible with DOS PKzip

userdel - remove an account (as root). The user's home directory
and undelivered mail must be dealt with separately.

users - prints list of users on the system

which - used to find utilities in search path. Will return the absolute
directory path of the named utility program.

who - display information about currently logged in userids

whoami - display information about userid that is currently logged in

X - starts up the X server. Same as startx

There are many commands available on your PCLinuxOS system. Not all commands have a man page. To see a complete explanation for using a command, in a terminal window enter man command_name, where command_name is the actual name of the command. For any command not containing a man page, command_name --help will usually show a summary of command options.

For more information visit LinuxCommand.org



Edited on 2007-01-03 20:55:48 by DevNet [added a link to linuxcommand.org]

Additions:
For more information visit LinuxCommand.org



Edited on 2006-10-27 23:53:36 by BlamE582 [command correction]

Additions:
usage: bzip2 [flags] file name

Deletions:
usage: same as Bunzip2



Edited on 2006-10-26 22:05:13 by DarrelJohnston [Added link to Contents page.]

Additions:
Back to Contents



Edited on 2006-10-26 21:41:28 by DarrelJohnston [Added CLI explanation.]

Additions:
CLI, or Command Line Interface, is also called shell or terminal. The standard shell used is bash. You can start a bash session by selecting the Konsole icon.



Edited on 2006-10-26 21:30:11 by DarrelJohnston [Wrapped ~ with double quotes to show on page. Edited some strings which generated create page links.]

Additions:
Before we get into cli commands we first need to understand bash notations
~ - home directory
Also we need to understand a few keyboard shortcuts
[Arrow Up] - scroll through the command history
[Shift][Page Up] - scroll terminal output up.
[Shift][Page Down] - scroll terminal output down
[Ctrl][Alt][Bk Spc] - kill the current X server. Used when normal
adduser - used by root to add user to system
ark - create, modify and extract from archives
chgrp - changes group associated with file. Can be used to change the
cmp - compares two files for differences
cp - copies on or more files. Recursive copying is one simple way
diff - displays differences between two files
e2fsck - check an ext2 filesystem. The syntax is e2fsck /dev/devicename
egrep - search files for lines that match regular expressions.
halt - immediately shut down system as root, without reboot
man - displays information from online Unix reference manual
There are many commands available on your PCLinuxOS system. Not all commands have a man page. To see a complete explanation for using a command, in a terminal window enter man command_name, where command_name is the actual name of the command. For any command not containing a man page, command_name --help will usually show a summary of command options.


Deletions:
Before we get into cli commands we first need to understand bash notations
- home directory
Also we need to understand a few keyboard shortcuts
[ArrowUp] - scroll through the command history
[Shift][PageUp] - scroll terminal output up.
[Shift][PageDown] - scroll terminal output down
[Ctrl][Alt][BkSpc] - kill the current X server. Used when normal
adduser - used by root to add user to system
ark - create, modify and extract from archives
chgrp - changes group associated with file. Can be used to change the
cmp - compares two files for differences
cp - copies on or more files. Recursive copying is one simple way
diff - displays differences between two files
e2fsck - check an ext2 filesystem. The syntax is e2fsck /dev/devicename
egrep - search files for lines that match regular expressions.
halt - shut down system as root, without reboot, immediately
man - displays information from online Unix reference manual




Edited on 2006-10-25 02:23:41 by BlamE582 [cli commands]

Additions:

Basic CLI command

List of Linux Bash Commands



Deletions:
Basic CLI command Introduction to CLI for the beginner
List of Linux Bash Commands




Oldest known version of this page was edited on 2006-10-25 02:22:30 by BlamE582 [Cli Commands]
Page view:
Basic CLI command

Introduction to CLI for the beginner

Before we get into cli commands we first need to understand bash notations

/ - root directory

./ - current directory

./command_name - run a command in the current directory when the
current directory is not on the path

../ - parent directory

- home directory

$ - typical prompt when logged in as ordinary user

# - typical prompt when logged in as root or superuser


Also we need to understand a few keyboard shortcuts



[Tab][Tab] or [Esc][Esc] - prints a list of all available commands.

x[Tab][Tab] or x[Esc][Esc] - prints a list of all available completions for a
command, where the beginning is``x

[Alt][Ctrl][F1]-[F6] - switch to the virtual text console

[Alt][Ctrl][F7]-[F12] - switch to the GUI console, if there is
one running.

[ArrowUp] - scroll through the command history

[Shift][PageUp] - scroll terminal output up.

[Shift][PageDown] - scroll terminal output down

[Ctrl][Alt][BkSpc] - kill the current X server. Used when normal
exit is not possible.

[Ctrl][Alt][Del] - shut down the system and reboot

[Ctrl]c - kill the current process

[Ctrl]d - logout from the current terminal

[Ctrl]s - stop transfer to current terminal

[Ctrl]q - resume transfer to current terminal. This should be
tried if the terminal stops responding.

[Ctrl]z - send current process to the background

List of Linux Bash Commands

access - determine whether a file can be accessed
Usage: access -MODE FILE
MODE is one or more of rwx. Exit successfully if FILE exists
and is readable (r), writable (w), or executable (x).

adduser - used by root to add user to system
Usage: useradd [options] LOGIN

agetty - enables login on terminals.
Usage: agetty [-hiLmw] [-l login_program] [-t timeout] [-I initstring]
[-H login_host] baud_rate,... line [termtype] or [-hiLmw]
[-l login_program] [-t timeout] [-I initstring] [-H login_host]
line baud_rate,... [termtype]

ark - create, modify and extract from archives
Usage: Calls Gui Ark

arch - print machine architecture type

bash - Bourne again shell. This is the default shell
Usage: bash [GNU long option] [option] ...
bash [GNU long option] [option] script-file ...
Type `bash -c "help set"' for more information about shell options.
Type `bash -c help' for more information about shell builtin
commands.

bunzip2 - used to uncompress files compressed with bzip2
usage: bunzip2 [flags and input files in any order]

bzip2 - compresses with algorithm different from gzip
usage: same as Bunzip2

bzless - view bzipped files
usage: bzless /folder/foo.txt.bz

bzcat - view bzipped files
Usage: bzcat /folder/foo.txt.bz

cd - change working directory.
Usage: cd dir

cfdisk - hard drive partion configurator
Usage: cfdisk

chgrp - changes group associated with file. Can be used to change the
group associated with subdirectories and files of a directory.
usage: chgrp group files or: chgrp -R group files

chkconfig - Query or update system services/daemons for different runlevels.

chmod - set permissions (modes) of files or directories.
A value of 4 is used for read permission.
A value of 2 is used for write permission.
A value of 1 is used for execute permission.

chown - changes ownership of a file. Can be used recursively.
usage: chown userid files
or: chown -R userid files

clear - clear screen command
usage: clear


cmp - compares two files for differences
usage: cmp file1 file2
cmp /etc/X11/xorg.conf /etc/X11/xorg.conf.old

cp - copies on or more files. Recursive copying is one simple way
of archiving part of a directory structure. Use the command as follows:
cp -r /sourcedirectory /targetdirectory

date - displays or sets date and time
usage: date

diff - displays differences between two files
usage: diff file1 file2 (same as cmp)

dmesg - displays messages from /var/log relative to the most recent boot
Usage: dmesg [-c] [-n level] [-s bufsize]

e2fsck - check an ext2 filesystem. The syntax is e2fsck /dev/devicename
where the filesystem is on /dev/devicename. The device should not
be mounted, and this program must be run as root.

echo - write arguments to standard output. One use is to print
out information about environment variables, as in
echo $PATH - list paths to search
echo $HOME or echo ~ - list name of home directory


egrep - search files for lines that match regular expressions.
Runs faster than grep and fgrep.

exit - exit a shell. This is a shell builtin.

fdformat - low level format of a floppy device

file - displays classification of a file or files according to the type of
data they contain

find - find files according to a large variety of search criteria.
The find command that I use the most is
find . -name filename -print

grep - used to find a string within a file. The -i option returns matches
without regard to case. The -n option means that each line of
output is preceded by file name and line number. The -v option
causes non-matched lines to be printed.
usage: grep pattern files
or: grep -i pattern files
or: grep -n pattern files
or: grep -v pattern files

groupadd - create a new group on the system

groups - shows which groups you are in

gunzip - used to uncompress files compressed with gzip

gzip - used to compress or decompress files

halt - shut down system as root, without reboot, immediately

history - command for viewing and manipulating the shell
command history list

ifconfig - display (as root) information on network interfaces that
are currently active. First ethernet interface should be
listed as eth0, second as eth1, etc. First modem ppp
connection should be listed as ppp0, etc. The ``lo
connection is ``loopback only.

ifdown - shut down the network interface

ifup [interface_name] - start up the interface

insmod - used (by root) to install modular device drivers

kill - sends a signal to (especially to terminate) a job or process.
This is a shell builtin in bash,tcsh and zsh.

killall - kill processes by name. Kill all processes which are instances
of the speciffied program. Also used to send signals to processes or
restart them.

killall5 - kill all processes except the ones on which it depends

less - Linux alternative to ``more command. Displays text files, one
screenful at a time. When less pauses, there is a large number of
available commands to tell it what to do next. One can scroll both
forwards and backwards.

ln - creates a link to a file. Used to create hard links and, with the -s
option, symbolic links which can link files on different disk partitions.
The syntax is - ln [options] source [dest]

logout - execute logout as individual user and bring up login: prompt

ls - list directory contents.

lsmod - used (by root) to show kernel modules currently loaded

lspci - utility to display information on pci buses and hardware
devices attached to them.

man - displays information from online Unix reference manual

mkdir - create a directory

mkfs - create a file system (format) on a device or partition.
Should be invoked after lowlevel formatting of the disk
using fdformat. It has several versions which are all links
to the basic program, such as mkfs.ext2

more - list file contents, stopping after each full screen




mount - mount device using filesystem of type [fstype] with device name
[device] at the location [mountpoint] in the filesystem directory tree
mount -a - mount all filesystems according to the specifications
in /etc/fstab

mv - moves (renames) files
usage: mv [src] [dest]
passwd - change login password

pwd - print absolute path of working directory. This is a shell builtin.

reboot - reboots the system. Seems to be equivalent to shutdown -r now

rm - remove files or directories. With the -r (recursive) option
(very dangerous!), can be used to remove the contents of a
specified directory including all subdirectories.

rmdir - remove empty directories

showmount - show information about an nfs server

shutdown - reboot or shut down system as root, after specified
amount of time. With the -r option, reboot. With
the -h option, halt the system.
usage: shutdown -r minutes

startx - front end to xinit in Linux. This is a script which starts
up X clients and shuts down the X server on exit from
the window manager

su - log in as another user, including root

sudo - allows individual users to have root permission to perform
specified tasks

umount [device] - finish writing to the device and remove it from
the active filesystem.
The command umount -a will (re)mount all file systems
listed in /etc/fstab.

unzip - uncompress files compressed with the zip utility,
compatible with DOS PKzip

userdel - remove an account (as root). The user's home directory
and undelivered mail must be dealt with separately.

users - prints list of users on the system

which - used to find utilities in search path. Will return the absolute
directory path of the named utility program.

who - display information about currently logged in userids

whoami - display information about userid that is currently logged in

X - starts up the X server. Same as startx



Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by Wikka Wakka Wiki 1.1.6.2
Page was generated in 0.2935 seconds