Linux Command Basics To execute a command, type its name and arguments at the command line ls -l /etc Command name Options (flags) Arguments
Common Commands pwd - print (display) the working directory cd < dir> - change the current working directory to dir ls - list the files in the current working directory ls -l - list the files in the current working directory in long format
File Commands cp <fromfile> <tofile> Copy from the <fromfile> to the <tofile> mv <fromfile> <tofile> Move/rename the <fromfile> to the <tofile> rm <file> Remove the file named <file> mkdir <newdir> Make a new directory called <newdir> rmdir <dir> Remove directory
More Commands who List who is currently logged on to the system whoami Report what user you are logged on as echo “A string to be echoed” Echo a string (displays a message) to the terminal
More Commands alias - used to tailor commands: alias erase=rm arch -Print machine architecture
More Commands awk - a file processing language that is well suited to data manipulation and retrieval of information from text files chown - sets the user ID (UID) to owner for the files and directories named by pathname arguments. This command is useful when from test to production
More Commands diff - attempts to determine the minimal set of changes needed to convert a file specified by the first argument into the file specified by the second argument find - Searches a given file hierarchy specified by path, finding files that match the criteria given by expression
More Commands grep - Searches files for one or more pattern arguments. It does plain string, basic regular expression, and extended regular expression searching pushd Save and then change the current directory pwd Print Working Directory
More Commands kill - sends a signal to a process or process group You can only kill your own processes unless you are root lprint Print a file lprintd Abort a print job lprintq List the print queue
More Commands df Display free disk space cp Copy one or more files to another location cat Display the contents of a file
More Commands tar - manipulates archives An archive is a single file that contains the complete contents of a set of other files; an archive preserves the directory hierarchy that contained the original files. gzip Compress or decompress named file(s)
Switching Users su <accountname> switch user accounts. You will be prompted for a password. When this command completes, you will be logged into the new account. Type exit to return to the previous account su Switch to the root user account. Do not do this lightly Note: The root user does not need to enter a password when switching users. It may become any user desired. This is part of the power of the root account.
References http:// www.linux.org http://www.tux.org http:// www.li.org
Thanks

Linux basic commands

  • 1.
    Linux Command BasicsTo execute a command, type its name and arguments at the command line ls -l /etc Command name Options (flags) Arguments
  • 2.
    Common Commands pwd - print (display) the working directory cd < dir> - change the current working directory to dir ls - list the files in the current working directory ls -l - list the files in the current working directory in long format
  • 3.
    File Commands cp <fromfile> <tofile> Copy from the <fromfile> to the <tofile> mv <fromfile> <tofile> Move/rename the <fromfile> to the <tofile> rm <file> Remove the file named <file> mkdir <newdir> Make a new directory called <newdir> rmdir <dir> Remove directory
  • 4.
    More Commands whoList who is currently logged on to the system whoami Report what user you are logged on as echo “A string to be echoed” Echo a string (displays a message) to the terminal
  • 5.
    More Commands alias - used to tailor commands: alias erase=rm arch -Print machine architecture
  • 6.
    More Commands awk - a file processing language that is well suited to data manipulation and retrieval of information from text files chown - sets the user ID (UID) to owner for the files and directories named by pathname arguments. This command is useful when from test to production
  • 7.
    More Commands diff - attempts to determine the minimal set of changes needed to convert a file specified by the first argument into the file specified by the second argument find - Searches a given file hierarchy specified by path, finding files that match the criteria given by expression
  • 8.
    More Commands grep - Searches files for one or more pattern arguments. It does plain string, basic regular expression, and extended regular expression searching pushd Save and then change the current directory pwd Print Working Directory
  • 9.
    More Commands kill - sends a signal to a process or process group You can only kill your own processes unless you are root lprint Print a file lprintd Abort a print job lprintq List the print queue
  • 10.
    More Commands df Display free disk space cp Copy one or more files to another location cat Display the contents of a file
  • 11.
    More Commands tar - manipulates archives An archive is a single file that contains the complete contents of a set of other files; an archive preserves the directory hierarchy that contained the original files. gzip Compress or decompress named file(s)
  • 12.
    Switching Users su <accountname> switch user accounts. You will be prompted for a password. When this command completes, you will be logged into the new account. Type exit to return to the previous account su Switch to the root user account. Do not do this lightly Note: The root user does not need to enter a password when switching users. It may become any user desired. This is part of the power of the root account.
  • 13.
    References http:// www.linux.orghttp://www.tux.org http:// www.li.org
  • 14.