Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Command cat Example Description Sends file contents to standard output. This is a way to list the contents of short files to the screen. It works well with piping. Sends the contents of the ".bashrc" file to the screen. Change directory Change the current working directory to /home. The '/' indicates relative to root, and no matter what directory you are in when you execute this command, the directory will be changed to "/home". Change the current working directory to httpd, relative to the current location which is "/home". The full path of the new working directory is "/home/httpd". Move to the parent directory of the current directory. This command will make the current working directory "/home. Move to the user's home directory which is "/home/username". The '~' indicates the users home directory. Copy files Copy the files "myfile" to the file "yourfile" in the current working directory. This command will create the file "yourfile" if it doesn't exist. It will normally overwrite it without warning if it exists. With the "-i" option, if the file "yourfile" exists, you will be prompted before it is overwritten. Copy the file "/data/myfile" to the current working directory and name it "myfile". Prompt before overwriting the file. Copy all files from the directory "srcdir" to the directory "destdir" preserving links (-p option), file attributes (-p option), and copy recursively (-r option). With these options, a directory and all it contents can be copied to another directory. Disk duplicate. The man page says this command is to "Convert and copy a file", but although used by more advanced users, it can be a very handy command. The "if" means input file, "of" means output file. Show the amount of disk space used on each mounted filesystem. Similar to the more command, but the user can page up and down through the file. The example displays the contents of textfile. Creates a symbolic link to a file.
cd httpd
cd .. cd ~ cp cpmyfileyourfile
Creates a symbolic link named symlink that points to the file test Typing "ls -i test symlink" will show the two files are different with different inodes. Typing "ls -l test symlink" will show that symlink points to the file test. A fast database driven file locator. locate slocate -u This command builds the slocate database. It will take several minutes to complete this command. This command must be used before searching for files, however cron runs this command periodically on most systems. locate whereis Lists all files whose names contain the string "whereis". Logs the current user off the system. logout List files ls ls List files in the current working directory except those starting with .and only show the file name. ls -al List all files in the current working directory in long listing format showing permissions, ownership, size, and time and date stamp Allows file contents or piped output to be sent to the screen more one page at a time. more /etc/profile Lists the contents of the "/etc/profile" file to the screen one page at a time. ls -al |more Performs a directory listing of all files and pipes the output of the listing through more. If the directory listing is longer than a page, it will be listed one page at a time. Move or rename files mv mv -i myfileyourfile Move the file from "myfile" to "yourfile". This effectively changes the name of "myfile" to "yourfile". mv -i /data/myfile . Move the file from "myfile" from the directory "/data" to the current working directory. Show the name of the current working directory pwd more /etc/profile Lists the contents of the "/etc/profile" file to the screen one page at a time. Shuts the system down. shutdown shutdown -h now Shuts the system down to halt immediately. shutdown -r now Shuts the system down immediately and the system reboots. Show where the binary, source and manual page files are for a whereis command whereisls Locates binaries and manual pages for the ls command.
ln -s test symlink
su-Linux Command
su command- Substitute user identity
usermod-Linux Command
Syntax: usermod [options] [user] Description: Modify a user account. Changes may be made to the password, group membership, expiration date, and other attributes of a given user's account. With this command, a user's password may be locked, which has the effect of disabling the account. Example: Related: useradd, userdel
echo-Linux Command
echo command- Display message on screen Syntax: echo [options]... [string]... Description: Bash has the echo commands to provide comments for users, and although you should be familiar with at least the use of echo by now, we will discuss some more examples in the next sections.The echo built-in command outputs its arguments, separated by spaces and terminated with a newline character. The return status is always zero. echo takes a couple of options: -e: interprets backslash-escaped characters. -n: suppresses the trailing newline. Example:
ps-Linux Command
ps command- Process status, information about processes running in memory Syntax:: Display Process info ps option(s) List all the keyword options ps [-L] Description: The ps will provide you a list of processes currently running. There is a wide variety of options that this command gives you. Example: Related: top, pstree, proc
df-Linux Command
df command- Display free disk space Syntax: df -options /dev/hdx
Description: The df is the simplest tool available to view disk usage. Simply type in df and you'll be shown disk usage for all your mounted filesystems in 1K blocks Example: Related: 2. diff command- Display the differences between two files
who-Linux Command
who command- Print who is currently logged in Syntax: who [options] [file] [am i] Description: Even easier than using the who and ps -u commands is to use the w. w will print out not only who is on the system, but also the commands they are running. Example: Related: groups, hostname, id, uname, logname, users, whoami
ls-Linux Command
ls command: List information about FILEs, by default the current directory.
list files, newest first list files, oldest first give information about the named file
listf month day year list files older than the given date In 1965, listf was extended to recognize ``*'' as a way to list all files that matched a specific pattern, with further improvements to the pattern matching in an updated version dated January 3, 1966. The 1966 version also generalized the syntax and added lots of options, including:
list only files, not links list files created by the given user
listf (made) mmddyy [mmddyy] list files created between the given dates listf (srec) listf (smad) listf (rev) listf (long) list by size list by date of last modification list in reverse order list in long format
When CTSS was superseded by Multics, the listf command was renamed to list, which could optionally be abbreviated to ls. The early version of ls had fewer options than late versions of listf had, but still included, along with a few others:
(ls -a)
list everything
list -date_time_modified (ls -dtm) list by date of last modification (ls -rv) list in reverse order
When Bell Labs dropped out of Multics development in 1969 and work began on Unix, only the abbreviated name of list, ls, was retained. The First Edition (November 3, 1971) Unix manual documented the following options for ls, all of which are still available today:
ls -l
ls -t sort by time modified ls -a list everything, including names starting with `.' ls -s include the size of files in the listing ls -d list directories' names, not their contents By the Fifth Edition (manual page dated March 20, 1974) the list of options for ls had expanded to include:
ls -r ls -i
ls -u use access time, not modification time list i-number for each file ls -f don't sort the listing at all The Sixth Edition (May, 1975) added one more:
ls -g
In May and August, 1977, Bill Joy made some modifications of his own to ls at the University of California, Berkeley, which he subsequently distributed as part of the First Berkeley Software Distribution, 1BSD. The most dramatic difference with this version of ls was that it listed files in multiple columns rather than only listing one name per line. The options to control this new format were:
ls -1 ls -c
ls -q show control characters as `?' ls -m everything on one line, separated by commas There was some controversy over whether it was appropriate to include code to print in columns as an integral part of ls or whether instead the formatting into columns should be done by a separate program into which the output of ls (or any other program) could be piped. At the beginning of 1979, Bell Labs released Seventh Edition Unix. Its version of ls did not incorporate the controversial changes, and had one new option that conflicted with a letter that Joy had also used:
ls -c
A new Berkeley version of ls, dated August 26, 1980 and released with 4.0BSD, resolved the conflict by capitalizing the option to list in columns: ls -C. It also added to what the manual was by this time calling ``an unbelievable number of options:''
ls -F
ls -R recursively list subdirectories ls -b show control characters as their ASCII codes Another revision in 4.2BSD (July 28, 1983) removed the -m, -b, and -x options -- but not before System V Release 2 had added all three of these to its own repertoire of options. They temporarily stayed alive there, but none of the three survived POSIX standardization so the 4.2BSD version of ls is essentially ls as we know it today. Example: Related: dir, dircolors, dirname, quota, rm, rmdir, wc
man-Linux Command
man command- Display helpful information about commands. Syntax: man [-k] [command] info [command] help [-s] [command] Description: These commands access the manual and information pages on system commands and installed utilities. When available, the info pages usually contain more detailed descriptions than do the man pages. Example: Related: more ,less
echo-Linux Command
echo command- Display message on screen Syntax: echo [options]... [string]... Description: Bash has the echo commands to provide comments for users, and although you should be familiar with at least the use of echo by now, we will discuss some more examples in the next sections.The echo built-in command outputs its arguments, separated by spaces and terminated with a newline character. The return status is always zero. echo takes a couple of options: -e: interprets backslash-escaped characters. -n: suppresses the trailing newline. Example: