linux terminal comenzi
DESCRIPTION
comenzi Linux GnomeTRANSCRIPT
Linux Terminal Command Reference
System Infodate Show the current date and time
cal Show this month's calendar
uptime Show current uptime
w Display who is online
whoami Who you are logged in as
fingeruser Display information aboutuser
uname -a Show kernel information
cat /proc/cpuinfo CPU information
cat /proc/meminfo Memory information
df-h Show disk usage
du Show directory space usage
free Show memory and swap usageKeyboard ShortcutsEnter Run the
command
Up Arrow Show the previous command
Ctrl + R Allows you to type a part of the command you're looking
for and finds itCtrl + Z Stops the current command, resume withfgin
the foreground orbgin the background
Ctrl + C Halts the current command, cancel the current operation
and/or start with a fresh new line
Ctrl + L Clear the screencommand| less Allows the scrolling of the
bash command window usingShift + Up ArrowandShift + Down
Arrow
!! Repeats the last command
command!$ Repeats the last argument of the previous command
Esc + . (a period) Insert the last argument of the previous command
on the fly, which enables you to edit it before executing the
commandCtrl + A Return to the start of the command you're
typing
Ctrl + E Go to the end of the command you're typing
Ctrl + U Cut everything before the cursor to a special clipboard,
erases the whole line
Ctrl + K Cut everything after the cursor to a special
clipboard
Ctrl + Y Paste from the special clipboard thatCtrl + UandCtrl +
Ksave their data to
Ctrl + T Swap the two characters before the cursor (you can
actually use this to transport a character from the left to the
right, try it!)
Ctrl + W Delete the word / argument left of the cursor in the
current lineCtrl + D Log out of current session, similar
toexitLearn the Commandsapropossubject List manual pages
forsubject
man -kkeyword Display man pages containingkeyword
mancommand Show the manual forcommand
man -tman| ps2pdf - >man.pdf Make a pdf of a manual page
whichcommand Show full path name ofcommand
timecommand See how long acommandtakeswhereisapp Show possible
locations ofapp
whichapp Show whichappwill be run by default; it shows the full
pathSearchinggreppatternfiles Search forpatterninfiles
grep -rpatterndir Search recursively forpatternindir
command |greppattern Search forpatternin the output ofcommand
locatefile Find all instances offile
find / -namefilename Starting with the root directory, look for the
file calledfilename
find / -name *filename* Starting with the root directory, look for
the file containing the stringfilename
locatefilename Find a file calledfilenameusing the locate command;
this assumes you have already used the commandupdatedb(see
next)
updatedb Create or update the database of files on all file systems
attached to the Linux root directory
whichfilename Show the subdirectory containing the executable file
calledfilename
grepTextStringToFind/dir Starting with the directory calleddir,
look for and list all files containingTextStringToFindFile
Permissionschmodoctalfile Change the permissions offiletooctal,
which can be found separately for user, group, and world by adding:
4 read (r), 2 write (w), 1 execute (x)
Examples:
chmod 777 read, write, execute for all
chmod 755 rwx for owner, rx for group and world
For more options, seeman chmod.File Commandsls Directory
listing
ls -l List files in current directory using long format
ls -laC List all files in current directory in long format and
display in columns
ls -F List files in current directory and indicate the file
type
ls -al Formatted listing with hidden filescddir Change directory
todir
cd Change to home
mkdirdir Create a directorydir
pwd Show current directoryrmname Remove a file or directory
calledname
rm-r dir Delete directorydir
rm -ffile Force removefile
rm -rfdir Force remove an entire directorydirand all its included
files and subdirectories (use with extreme caution)cpfile1 file2
Copyfile1tofile2
cp -rdir1 dir2 Copydir1todir2; createdir2if it doesn't exist
cpfile/home/dirname Copy the filename calledfileto
the/home/dirnamedirectorymvfile/home/dirname Move thefilecalled
filename to the/home/dirnamedirectory
mvfile1 file2 Rename or movefile1tofile2; iffile2is an existing
directory, movesfile1into directoryfile2ln -sfile link Create
symbolic linklinktofile
touchfile Create or updatefile
cat >file Places standard input intofile
catfile Display the file calledfilemorefile Display the file
calledfileone page at a time, proceed to next page using the
spacebar
headfile Output the first 10 lines offile
head -20file Display the first 20 lines of the file
calledfile
tailfile Output the last 10 lines offile
tail -20file Display the last 20 lines of the file calledfile
tail -ffile Output the contents offileas it grows, starting with
the last 10 linesCompressiontar cffile.tar files Create a tar
namedfile.tarcontainingfiles
tar xf file.tar Extract the files fromfile.tartar czffile.tar.gz
files Create a tar with Gzip compression
tar xzffile.tar.gz Extract a tar using Gziptar cjf file.tar.bz2
Create a tar with Bzip2 compression
tar xjffile.tar.bz2 Extract a tar using Bzip2gzipfile
Compressesfileand renames it tofile.gz
gzip -dfile.gz Decompressesfile.gzback
tofilePrinting/etc/rc.d/init.d/lpd start Start the print
daemon
/etc/rc.d/init.d/lpd stop Stop the print daemon
/etc/rc.d/init.d/lpd status Display status of the print
daemon
lpq Display jobs in print queue
lprm Remove jobs from queue
lpr Print a file
lpc Printer control tool
mansubject| lpr Print the manual page calledsubjectas plain
text
man -tsubject| lpr Print the manual page calledsubjectas Postscript
output
printtool Start X printer setup interfaceNetworkifconfig List IP
addresses for all devices on the local machine
iwconfig Used to set the parameters of the network interface which
are specific to the wireless operation (for example: the
frequency)
iwlist used to display some additional information from a wireless
network interface that is not displayed byiwconfig
pinghost Pinghostand output results
whoisdomain Get whois information fordomain
digdomain Get DNS information fordomain
dig -xhost Reverse lookuphost
wgetfile Downloadfile
wget -cfile Continue a stopped downloadSSHsshuser@host Connect
tohostasuser
ssh -pport user@host Connect tohoston portportasuser
ssh-copy-iduser@host Add your key tohostforuserto enable a keyed or
passwordless loginUser Administrationadduseraccountname Create a
new user callaccountname
passwdaccountname Giveaccountnamea new password
su Log in as superuser from current login
exit Stop being superuser and revert to normal userProcess
Managementps Display your currently active processes
top Display all running processes
killpid Kill process idpid
killallproc Kill all processes namedproc(use with extreme
caution)
bg Lists stopped or background jobs; resume a stopped job in the
background
fg Brings the most recent job to foreground
fgn Brings jobnto the foregroundInstallation from
source./configure
make
make install
dpkg -ipkg.deb install a DEB package (Debian / Ubuntu / Linux
Mint)
rpm -Uvhpkg.rpm install a RPM package (Red Hat / Fedora)Stopping
& Startingshutdown -h now Shutdown the system now and do not
reboot
halt Stop all processes - same as above
shutdown -r 5 Shutdown the system in 5 minutes and reboot
shutdown -r now Shutdown the system now and reboot
reboot Stop all processes and then reboot - same as above
startx Start the X system