$ps -e "kworker$" error: unknown sort specifier Usage: ps [options] Try 'ps --help ' or 'ps --help' for additional help text. For more details see ps(1). $ps -ef | grep "^daemon" daemon 639 1 0 May04 ? 00:00:00 /usr/sbin/atd -f $ps -ef | grep "^rtkit" rtkit 1245 1 0 May04 ? 00:00:00 /usr/lib/rtkit/rtkit-daemon $ps -ef | grep "^systemd+" systemd+ 522 1 0 May04 ? 00:00:00 /lib/systemd/systemd-timesyncd $
why does “exit status 0” mean success?
Tinkering with trap and exit commands
TYPICAL COMMANDLINE SESSION
[bash]
$echo $?
0
$echo $?
0
$exit 10 | tee solve.txt
$cat solve.txt
$rm solve.txt
$exit 10 | echo $?
0
$exit -1 | echo $?
0
$exit -1 | echo $?
0
$false | true
$echo $?
0
$false
$echo $?
1
$true
$echo $?
0
$exit 5 | tee var=$?
$file var\=0
var=0: empty
$type var
bash: type: var: not found
$file var\=0
var=0: empty
$
[/bash]
[bash]
$trap $? > solve.txt exit 10
$cat solve.txt
Display all 296 possibilities? (y or n)
$cat solve.txt
$trap echo $? > solve.txt exit 10
$cat solve.txt
$trap `echo $? > solve.txt` exit 10
$cat solve.txt
0
$
[/bash]
[bash]
$bash -c ‘exit 7’; echo $?
7
$bash -c `exit 7`; echo $?
bash: -c: option requires an argument
2
$bash -c ‘exit 7’; echo $?
7
$trap ‘echo $? > solve.txt’ exit 10
$cat solve.txt
0
$cat solve.txt
0
$bash -c ‘exit 11’; echo $?
11
$
[/bash]
Indicate how each name would be interpreted if used as a command name
$type -a locate locate is /usr/bin/locate $type -a ls ls is aliased to `ls --color=auto' ls is /bin/ls $type -t ls alias $type -t locate file $type -t /dev/urandom $type -t /dev/sda1 $type -t urandom $type -t sda1 $type -t type builtin $type -t shuf file $type -t bash file $type -t proc $type -t debugfs $sudo type -t debugfs [sudo] password for jeffrin: sudo: type: command not found $sudo type -t debugfs sudo: type: command not found $
Non-deterministic Algorithms
sort – sort lines of text files
$cat test.txt sept aug jan dec oct apr feb mar11 mar1 $sort test.txt apr aug dec feb jan mar1 mar11 oct sept $sort -M test.txt jan feb mar1 mar11 apr aug sept oct dec $
What is Tracker?
GNU Diffutils is a package of several programs related to finding differences between files
fold: Wrap input lines to fit in specified width
$cat test.pl
use strict;
use File::Rename ();
use Pod::Usage;
main() unless caller;
sub main {
my $options = File::Rename::Options::GetOptions
or pod2usage;
mod_version() if $options->{show_version};
pod2usage( -verbose => 2 ) if $options->{show_manual};
pod2usage( -exitval => 1 ) if $options->{show_help};
@ARGV = map {glob} @ARGV if $^O =~ m{Win}msx;
File::Rename::rename(\@ARGV, $options);
}
sub mod_version {
print __FILE__ .
' using File::Rename version '.
$File::Rename::VERSION ."\n\n";
exit 0
}
1;
__END__
$
$fold -w 10 -b test.pl > part1.txt
$fold -w 10 test.pl > part2.txt
$diff -u part1.txt part2.txt
--- part1.txt 2018-03-15 22:50:38.084905051 +0530
+++ part2.txt 2018-03-15 22:50:48.768963638 +0530
@@ -55,10 +55,10 @@
rsion {
print
__FILE__ .
- ' using F
-ile::Renam
-e version
-'.
+ '
+using File
+::Rename v
+ersion '.
$F
ile::Renam
e::VERSION