*
then it will give you this for all files in the current directory.
%CODE{bash}%
fgrep "words" yourfile.txt
%ENDCODE%
Print only lines in a file containing the given "words" in a particular file.
%CODE{bash}%
find word*
%ENDCODE%
Locates and gives file names of all files in the working directory containing word in the beginning of the file name. The * represents a wildcard so it can be placed before, after, or both in order to find files that contain the given query in a particular part of the file name.%CODE{bash}% kill process %ENDCODE% Ends a particular process. Note that you can type
killall
to end multiple processes that match the name that is input.
%CODE{bash}%
ls
%ENDCODE%
Lists the contents of the working directory. Add -a
to include invisible files. Add -l
to show more information about each file such as its owner and permission flags.
%CODE{bash}%
mkdir directoryname
%ENDCODE%
Makes a directory with a name specified by the user.
%CODE{bash}%
nl yourfile.txt
%ENDCODE%
Numbers all the lines of a file.
%CODE{bash}%
ps
%ENDCODE%
Lists all process currently running.
%CODE{bash}%
pwd
%ENDCODE%
Prints the working directory path to the console.
%CODE{bash}%
rm yourfile.txt
%ENDCODE%
Deletes a given file.
%CODE{bash}%
rmdir yourdirectory
%ENDCODE%
Deletes a given directory.
%CODE{bash}%
source yourfile
%ENDCODE%
Reads and executes commands from the given file in the current environment.
%CODE{bash}%
which yourprogram
%ENDCODE%
Prints the the full path of the program to the console (note that its directory must be in your $PATH
). Adding an -a
after which prints all instances of the program.
.bashrc
, .zshrc
, or similar shell startup script:
%CODE{bash}%
export PS1='\w\$ '
%ENDCODE%
Now your current working directory will show up as part of your prompt. This can save you a lot of time typing ls
.